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

TCP connection not closed when Disruptor fails to shutdown within the grace period #569

Closed
brenuart opened this issue Jul 10, 2021 · 0 comments · Fixed by #565
Closed

TCP connection not closed when Disruptor fails to shutdown within the grace period #569

brenuart opened this issue Jul 10, 2021 · 0 comments · Fixed by #565
Milestone

Comments

@brenuart
Copy link
Collaborator

brenuart commented Jul 10, 2021

The TCP connection is closed in TcpSendingEventHandler#onShutdown (see https://github.com/logstash/logstash-logback-encoder/blob/logstash-logback-encoder-6.6/src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java#L644-L649). This method - part of the Disruptor LifecycleAware interface - is invoked by the Disruptor when it is shutdown.

When shutdown, the Disruptor first waits during a configurable period of time until all events are processed. If some events remain in the buffer after this period is elapsed, it throws a TimeoutException and the shutdown sequence is aborted. In this scenario the onShutdown method of the TcpEventHandler is not invoked and the connection remains open.

@philsttr philsttr linked a pull request Jul 11, 2021 that will close this issue
@brenuart brenuart added this to the 7.0 milestone Jul 14, 2021
philsttr pushed a commit that referenced this issue Jul 14, 2021
…ut (#565)

* Add ability block with optional timeout when appending to async appenders
* Wait for the buffer to drain before calling Disruptor#shutdown

Calling Disruptor#shutdown(timeout) while the buffer is not empty causes the disruptor to wait in a busy-loop consumuing a lot of CPU. Instead, wait during the grace period before asking the disruptor to shutdown immediately.

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

Successfully merging a pull request may close this issue.

1 participant