Repository navigation
Conversation
A ServiceRegistryRef built from a bare ServiceRegistry takes the device salt from a default argument, so anywhere a function wants a ref and is handed a registry, one is conjured silently -- including on a worker, where it claims to be the main thread. Requiring it to be spelled out means the salt has to be chosen on purpose. Doing so found two places where it was the wrong one. doRun is handed a ref carrying the salt of the stream it is running for, but built its DanglingContext and EndOfStreamContext from *context.registry, which silently produced a device-level ref, so everything those callbacks reach went looking in the wrong place. They now use the ref they were given. That also defeated a check which exists precisely to stop this: flushMetrics refuses to run unless isMainThread(), and with a device-level ref manufactured on a pool thread it happily agreed. Rather than the intended fatal, it went on to race the driver and die in DPLMonitoringBackend::send with a bad_variant_access. Every other call site is device level and now says so.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A ServiceRegistryRef built from a bare ServiceRegistry takes the device salt from
a default argument, so anywhere a function wants a ref and is handed a registry,
one is conjured silently -- including on a worker, where it claims to be the main
thread. Requiring it to be spelled out means the salt has to be chosen on
purpose.
Doing so found two places where it was the wrong one. doRun is handed a ref
carrying the salt of the stream it is running for, but built its DanglingContext
and EndOfStreamContext from *context.registry, which silently produced a
device-level ref, so everything those callbacks reach went looking in the wrong
place. They now use the ref they were given.
That also defeated a check which exists precisely to stop this: flushMetrics
refuses to run unless isMainThread(), and with a device-level ref manufactured on
a pool thread it happily agreed. Rather than the intended fatal, it went on to
race the driver and die in DPLMonitoringBackend::send with a bad_variant_access.
Every other call site is device level and now says so.