Repository navigation
Conversation
When the connection was already closed or errored (for example because the peer closed first), close() returns early without joining the worker thread. The destructor then deleted a joinable std::thread, which calls std::terminate. CuraEngine aborts at exit with "terminate called without an active exception".
quix2k23
added a commit
to quix2k23/cura-inner-outer-inner
that referenced
this pull request
Nov 21, 2026
UltiMaker's libArcus deletes a still-joinable thread in Socket::~Socket() when Cura closed the connection first, so CuraEngine aborted at exit (terminate called without an active exception). The release build now exports a patched arcus recipe (scripts/patch-arcus.py, fix offered upstream as Ultimaker/libArcus#168), checks that the engine resolves to it, and on Linux runs a repro test against the packaged library.
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.
Problem
Socket::~Socket()can callstd::terminate. CuraEngine then aborts at exit with:Stack (CuraEngine 5.14.0 on Linux):
When the socket is already
ClosedorError(for example because Cura closed the connection first),close()takes its early-return branch and does not join the worker thread. The destructor then runsdelete d->threadon a thread that is still joinable, andstd::thread::~thread()callsstd::terminate. The worker loop has already exited in that state, so joining returns immediately.On Linux the abort shows up as a crash report for CuraEngine (for example in ABRT on Fedora), even though the slice itself completed.
Fix
Join the thread (if joinable) before deleting it in the destructor, and reset the pointer.
How I tested
A small program that reproduces it: connect an
Arcus::Socketto a plain TCP listener, close the accepted connection from the listener side, wait until the socket reportsClosed/Error, then delete the socket.terminate called without an active exception(exit 134).Repro program
Side note (not changed here)
The condition just above,
d->state != SocketState::Closed || d->state != SocketState::Error, is always true, soclose()is always called. That is harmless with this fix, so I left it alone to keep the change minimal.&&was probably intended.