BatchSpanProcessor#force_flush: purge inherited spans even on shutdown #1537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: #363
Ref: Shopify/pitchfork#74
At Shopify we're using the Pitchfork web server, and one thing it does is that it sometimes do a "double fork", similar to the classic daemonization dance.
Recently we noticed that sometimes the "middle process" of that daemonization dance would get "stuck". After adding some debug we figured it's because we have:
So the child process inherits lots of spans from its parents, and normally OpenTelemetry deal gracefully with that by droping the inherited spans.
But here because we called
shutdown
,@keep_running
is set tofalse
hencereset_on_fork
is not called.I don't understand why we shouldn't call it during shutdown though, aside from avoiding to respawn the thread.
With this change we expect our "middle process" to drop all the inherited spans and to have nothing to flush.
@fbogsany @robertlaurin
cc @DazWorrall @bmansoob