fix(amule): apply wxWebSession-cleanup _Exit workaround on all platforms - #159
Merged
got3nks merged 1 commit intoJun 14, 2026
Merged
Conversation
…atforms
The macOS-only `std::_Exit(0)` block in OnExit() was added to dodge a
wxWebSessionURLSession dtor bug under wx 3.3.2. Turns out the
Linux backend (wxWebSessionCURL, wx 3.2.6) hits the same class of
shutdown crash: its dtor calls curl_multi_cleanup, libcurl invokes the
registered socket callback (wxWebSessionCURL::SocketCallback) to drop
tracked sockets, and that callback dereferences session state the
dtor's earlier steps have already torn down. wxASSERT fires,
wxFatalSignalHandler raise(SIGABRT)s.
Verified with a debug-symbol Flatpak + gdb on a user-supplied core,
fully symbolicated:
amule-project#19 main amule-gui.cpp:98
amule-project#18 wxEntry wx/init.cpp:500
amule-project#17 wxEntryCleanup wx/init.cpp:205
amule-project#16 wxModule::CleanUpModules wx/module.cpp:191
amule-project#15 wxModule::DoCleanUpModules wx/module.cpp:200
amule-project#14 wxRefCounterMT::DecRef
wxWebSession::Close wx/webrequest.cpp:1074
amule-project#13 wxWebSessionCURL::~wxWebSessionCURL wx/webrequest_curl.cpp:932
amule-project#12 wxWebSessionCURL::~wxWebSessionCURL wx/webrequest_curl.cpp:929
amule-project#11-amule-project#6 libcurl curl_multi_cleanup
amule-project#5 wxWebSessionCURL::SocketCallback wx/webrequest_curl.cpp:1047
amule-project#4 raise()
amule-project#3 wxFatalSignalHandler wx/unix/utilsunx.cpp:1523
#0 abort
Same justification used for the macOS guard applies on every
platform: by this point in OnExit we have saved state, joined
threads, and flushed logs -- nothing aMule-owned remains to clean up.
_Exit bypasses atexit and static destructors uniformly, so the buggy
wx dtor never runs and the process terminates cleanly.
Remove this once the upstream wx fix lands in a release we depend on.
Reported in amule-project#18.
This was referenced Jun 14, 2026
got3nks
added a commit
that referenced
this pull request
Jul 3, 2026
…#285) The monolithic app already bypasses wx's static-destructor / module cleanup in CamuleGuiApp::OnExit to avoid a crash in the platform wxWebSession destructor at quit (#18, PR #159). The remote GUI uses a separate app class (CamuleRemoteGuiApp) whose OnExit never got the same guard, so amulegui still SIGABRTs on quit in WebRequestModule::OnExit -> wxWebSessionURLSession::~ on macOS (wx 3.3.2). It links wxWebRequest too, so it hits the identical path. Apply the same std::_Exit(0) after amulegui's own cleanup (timer, sockets) has run.
Cflsft
pushed a commit
to Cflsft/amule
that referenced
this pull request
Jul 6, 2026
…amule-org#285) The monolithic app already bypasses wx's static-destructor / module cleanup in CamuleGuiApp::OnExit to avoid a crash in the platform wxWebSession destructor at quit (amule-org#18, PR amule-org#159). The remote GUI uses a separate app class (CamuleRemoteGuiApp) whose OnExit never got the same guard, so amulegui still SIGABRTs on quit in WebRequestModule::OnExit -> wxWebSessionURLSession::~ on macOS (wx 3.3.2). It links wxWebRequest too, so it hits the identical path. Apply the same std::_Exit(0) after amulegui's own cleanup (timer, sockets) has run.
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.
Fixes #18 (cardpuncher's Fedora 44 KDE Flatpak shutdown crash, and any other Linux user hitting
SIGABRTon close after an HTTP fetch).What's happening
The
std::_Exit(0)block inOnExit()was added in a prior commit to dodge a wxWebSessionURLSession dtor bug under wx 3.3.2 (macOS, NSURLSession reference-counting mismatch). Turns out the Linux backend (wxWebSessionCURL, wx 3.2.6) hits the same class of cleanup-time race:main()returns,wxEntryCleanupruns wx module destructors.wxWebSessionCURL::~wxWebSessionCURLcallscurl_multi_cleanup.wxWebSessionCURL::SocketCallback) to drop tracked sockets.wxASSERTfires →wxFatalSignalHandler→raise(SIGABRT).Verified end-to-end with a debug-symbol Flatpak + gdb on a user-supplied core, fully symbolicated:
What this PR does
Drops the
#if defined(__APPLE__)guard around the existingstd::_Exit(0)so it runs on every platform. Same justification holds everywhere: by this point inOnExit()we have saved state, joined threads, and flushed logs — nothing aMule-owned remains to clean up._Exitbypassesatexitand static destructors uniformly, so the buggy wx dtor never runs and the process terminates cleanly.The block stays time-bounded — comment notes "remove once the upstream wx fix lands in a release we depend on".
Test plan