This repository has been archived by the owner on Dec 23, 2023. It is now read-only.
TimeLimitedHandler creates an executor on every invocation of export() and does not shut it down causing application shutdown to hang #2031
Labels
What version of OpenCensus are you using?
0.26.0
What JVM are you using (
java -version
)?Tested on
11.0.6+10-post-Ubuntu-1ubuntu118.04.1
andadoptopenjdk:14_36-jre-hotspot
What did you do?
Setup trace exporting to zipkin about like this:
Run some code which generates spans so that the
io.opencensus.exporter.trace.util.TimeLimitedHandler.export()
method gets called. Shutdown the exporter by callingTracing.getExportComponent().shutdown()
Exit the application by returning from a the main method.
What did you expect to see?
Application exits quickly.
What did you see instead?
Application hangs. Upon further investigation, the application is being kept alive by some number of non-daemon threads named
pool-#-thread-1
. I eventually tracked these threads down to the zipkin exporter and specifically, theTimeLimitedHandler
class's export method:Every invocation of this method will creates a single thread executor for the
SimpleTimeLimiter
. The executor is never shut down, leaving its thread to idle for eternity.The text was updated successfully, but these errors were encountered: