-
Notifications
You must be signed in to change notification settings - Fork 56
LDClient doesn't shutdown properly in the streaming mode #93
Comments
Hi @dnetrebenko-smartling , we fixed an issue with a background connection recently. Do you mind checking version 2.2.2 to see if that resolves the issue you're seeing? |
Hi!
LD client hasn't been initialized. I don't understand what's wrong... |
@dnetrebenko-smartling I just released 2.2.3 which should resolve the initialization issue. Please give it a shot, and let me know if you have any issues. |
Thanks @dnetrebenko-smartling, I will look into this today. |
@dnetrebenko-smartling It looks like these threads are managed by OkHttp, and they should be released automatically if they are idle for long enough: http://square.github.io/okhttp/3.x/okhttp/index.html?okhttp3/OkHttpClient.html (grep for "Shutdown isn't necessary"). That said, I can add the calls mentioned in those docs to explicitly release those resources when the LDClient is closed, to make the shutdown more clean (it would be impossible for these resources to be used again after the LDClient is shutdown, so there is no point in waiting for OkHttp to clean them up). |
@pkaeding Yes, you're right. Those threads will die after ~175 seconds. It's acceptable for a console application. When the main thread dies the application will shutdown independently of state of those threads. But for Tomcat + Spring web application it's not acceptable. Because those threads prevent correct shutdown (restart) of it. |
Hi! any news about the issue? |
Hi @dnetrebenko-smartling Yes, I started digging into this, but I was still seeing some resources stick around after adding the calls mentioned in the link above. I will continue to work on this to see if we can make some headway. |
Hi @dnetrebenko-smartling I've improved resource management and narrowed down the lingering threads to this issue: square/okio#256 which unfortunately means we still have the Okio watchdog thread sticking around for 60 seconds after we call Please let us know if this is any better, and if it's still not working well enough let's move this to a support ticket by emailing [email protected] |
@dnetrebenko-smartling Have you had a chance to check out the 2.2.6-SNAPSHOT client? |
@dnetrebenko-smartling I reached out to you via email to help you resolve this based on your particular config. If you didn't get it, please contact [email protected]. We'll be able to pick up where we left off here. |
avoid some inappropriate uses of Guava's ImmutableMap
is this issue fixed, I am using LDClient 4.1.0 and facing the issue: ERROR [okhttp-eventsource-events-[]-0] StreamProcessor - Encountered EventSource error: connect timed out", Can anyone help. |
@Vishalb20 That seems unrelated to the issue you've posted on. This issue is about worker threads not being terminated at shutdown. What you're describing is some kind of network connection failure, and it's not possible to diagnose it from that log message without knowing more information. It may or may not have anything to do with the Java SDK in particular. Could you please raise a support ticket by going to https://support.launchdarkly.com/hc/en-us or emailing [email protected] so that the support team can help in investigating this problem? Thanks. |
Also, I'm closing this issue since there has been no activity on it in over a year. (To clarify the status of the original issue, it had to do specifically with daemon threads preventing the restart of a Tomcat application; we did make some Java SDK changes related to this, but to some degree it was an OkHttp issue that could not be completely worked around. However, we've had no further reports of problems in Tomcat since then to my knowledge.) |
Hi!
We have a web application under Tomcat server which uses Java LDClient (v. 2.1.0, streaming mode) to access feature flags.
We have a problem with shutdown of our application. It doesn't stop within 60 seconds.
Our shutdown routine looks like:
Almost all threaddumps contain following threads:
If we switch the LDClient to events mode the application stops within a few seconds.
EventSource.java:
It looks like we never leave bs.readUtf8LineStrict().
You can reproduce the issue using very simple console application:
The threads will die after ~175 seconds delay.
The text was updated successfully, but these errors were encountered: