Repository navigation
T-17170 Resolve proxy settings once so forked RQ work horses on macOS stop crashing at flush - #49
Merged
Merged
Conversation
…ng them across the fork reset requests asks the environment, and on macOS SystemConfiguration, for proxy settings on every request. A forked RQ work horse crashes in that lookup, so the uploader must resolve the settings once in the parent and its fresh post-fork session must reuse them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s fresh session Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Testing 0.4.1 end to end on macOS: every RQ work horse run by
logtail.rq.Workercrashed during its flush, and the job's records were lost while RQ still reported the job as finished, because the flush runs after the status is written. The crash is insiderequests' proxy lookup: with no proxy environment variables set,requestsasks macOS SystemConfiguration for proxy settings on every request, and CoreFoundation refuses to run in a child forked from a multithreaded process. An RQ worker is always multithreaded at fork time (it runs a pubsub listener thread), so nothing about this is specific to the handler's flush thread, andOBJC_DISABLE_INITIALIZE_FORK_SAFETY=YESdoes not help, since that silences the Objective-C check but not the CoreFoundation one. Linux has no such lookup and is unaffected.The first commit adds the tests and is expected to fail CI. The second commit makes the uploader resolve the proxy settings and the CA bundle from the environment once, when it is created, and pins them on the session with
trust_env=False. The fork reset then gives the child a fresh session with the same resolved settings instead of a new uploader, so the child never consults SystemConfiguration. What changes for everyone:HTTPS_PROXY,NO_PROXY, macOS or Windows system settings) andREQUESTS_CA_BUNDLE/CURL_CA_BUNDLEare read once per handler instead of on every upload, resolved with the samerequestshelper the per-request path uses.netrcentry for the ingesting host is no longer applied; it would have replaced the bearer token with basic authVerified on a Mac with the RQ scenario that crashed on 0.4.1: three runs with this change, zero crash reports, every job record delivered, no duplicated worker lines. CI cannot reproduce the crash, the tests pin the resolved settings and their survival across the fork reset.
🤖 Generated with Claude Code