Don't destroy _fileTransfer on shutdown#15792
Merged
Conversation
This is responsible for a lot of crash reports in Sentry (presumably due to destructor ordering issues). Since there is no cleanup done by this class that we care about, just leak it.
Contributor
|
Hm I feel like I should put up that match that disables all global destructors, otherwise we're going to play a game of whack-a-mole forever. I'll link it to this PR |
Contributor
|
Turns out we have global |
xokdvium
reviewed
May 6, 2026
Comment on lines
+1186
to
1196
| static auto * const _fileTransfer = new Sync<std::shared_ptr<curlFileTransfer>>; | ||
|
|
||
| ref<FileTransfer> getFileTransfer() | ||
| { | ||
| static ref<curlFileTransfer> fileTransfer = makeCurlFileTransfer(); | ||
| auto fileTransfer(_fileTransfer->lock()); | ||
|
|
||
| if (fileTransfer->state_.lock()->isQuitting()) | ||
| fileTransfer = makeCurlFileTransfer(); | ||
| if (!*fileTransfer || (*fileTransfer)->state_.lock()->isQuitting()) | ||
| *fileTransfer = makeCurlFileTransfer().get_ptr(); | ||
|
|
||
| return fileTransfer; | ||
| return ref<FileTransfer>(*fileTransfer); | ||
| } |
Contributor
There was a problem hiding this comment.
Strictly speaking, we don't need the global but @edolstra tells me that it's used in detnix to hackily replace it after a fork in the child process, so it seems fine for now.
xokdvium
approved these changes
May 6, 2026
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.
Motivation
This is responsible for a lot of crash reports in Sentry (presumably due to destructor ordering issues). Since there is no cleanup done by this class that we care about, just leak it.
We can probably get rid of all the
isQuitting()stuff, but this PR doesn't do that.Context
Taken from DeterminateSystems#444.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.