Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when closing the TCP socket before the first message is sent #131

Open
LiamLamb opened this issue Apr 4, 2024 · 1 comment
Labels

Comments

@LiamLamb
Copy link

LiamLamb commented Apr 4, 2024

Jenkins and plugins versions report

We're using the TcpSyslogMessageSender to send audit logs in the RFC5424 format to a local rsyslog server.

Our service creates an instance of TcpSyslogMessageSender when it starts and begins emitting events once the start-up procedure has been completely successful.

In cases where our service is shutdown before the first audit event is dispatched, we've noticed that the close method on the TcpSyslogMessageSender can throw a null point exception as the socket hasn't been assigned yet and is indeed null at that stage.

There are other parts of this class that leverage com.cloudbees.syslog.util.IoUtils#closeQuietly, which looks like a suitable solution to this issue.

Keen to get your thoughts on this,
Thanks

What Operating System are you using (both controller, and any agents involved in the problem)?

Error happening on a Windows Feature Experience Pack 1000.19053.1000.0

Reproduction steps

  1. Create a project using com.cloudbees:syslog-java-client:1.1.7
  2. Create an instance of TcpSyslogMessageSender
  3. Invoke the close() method on the TcpSyslogMessageSender instance

Expected Results

Not exception to be thrown

Actual Results

Null pointer exception is thrown

Anything else?

No response

Are you interested in contributing a fix?

Happy to contribute and fix this issue if the solution is adequate enough

@LiamLamb LiamLamb added the bug label Apr 4, 2024
@LiamLamb
Copy link
Author

LiamLamb commented Apr 4, 2024

Just noticed this has already been raised in #43 and covered in #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant