Conversation
Interposing __cxa_throw puts a frame belonging to this library between every
throw in Plex and the catch that was meant to handle it, and Plex does not
survive that. The first exception the process throws is fatal whatever it
was, which is why this surfaced as three unrelated looking crashes -- all of
them exceptions Plex throws and handles perfectly well on its own:
std::out_of_range: basic_string
std::domain_error: Invalid uuid length
UnauthorizedException: HTTP status code 401
One request reproduces it in a minute, with no Kubernetes and no cluster:
GET /media/providers, no token
plain Plex, own SQLite -> 401, keeps running
shim + fresh PostgreSQL -> terminates, uncaught
without this hook -> 401, keeps running
A throw/catch test built against libstdc++ passes with the hook loaded, which
is how it survived review: libstdc++ and libgcc are a matched pair and the
forward is harmless between them. Plex is libc++ with LLVM's unwinder, and
that is the pairing that breaks.
The hook and the __cxa_throw backtrace that depends on it are kept behind an
"exception-hook" feature, off by default, because the backtrace is what found
the NULL column-type bug and is worth having for the next one. Turning it on
means accepting that Plex will die on its first exception.
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
Plex 1.43.4 uses libc++ and LLVM's unwinder. Exporting
__cxa_throwfrom the preload shim inserts an incompatible interposed frame between routine Plex throws and their intended catches. In our isolated QNAP migration, GDB caughtstd::domain_error: Invalid uuid lengthin thePMS GTPthread. The value wasadaptive_bitrate, a normal non-UUID input that Plex is expected to handle; with the shim export it aborted instead. The same fork author reproduced the failure with an unauthenticated/media/providersrequest, which should return 401 and keep running.Fix
Carry the mediactl fork's
6db8e37commit, preserving its original author. Gate the exported__cxa_throwhook behind an off-by-defaultexception-hookfeature, retaining it for deliberate diagnostics.Verification
The mediactl shim built for x86-64 and its dynamic symbol table contains no exported
__cxa_throw. An isolated migration trial with the same patched Plex binary and a fresh PostgreSQL database is in progress; production remains on SQLite.Related: #27 addresses separate vfork and Boost codecvt startup failures.