Plex Media Scanner crashes on tracks with FlagCommentary=1

Reposting this. The original was removed, apparently for disclosing that I used an AI assistant during the investigation. To be unambiguous: I’m a developer, with 20 years of experience, I personally ran and verified every step below on my own hardware, and the reproduction steps are empirical when setting the flag it reproduces a crash every time on different files.

This almost certainly affects many users. Public forum threads going back years describe the same symptom with no resolution.


Reproduction Steps (any .mkv):

mkvpropedit FILE --edit track:N --set flag-commentary=1
Plex Media Scanner --analyze --item ITEM_ID    # crashes
mkvpropedit FILE --edit track:N --delete flag-commentary
Plex Media Scanner --analyze --item ITEM_ID    # works

Setting flag-commentary=1 on any track of a previously-working file makes Plex Media Scanner crash. Clearing it restores normal operation. No other content change. Verified on multiple .mkv files including one with no commentary metadata before I added the flag.


Environment:

  • Plex Media Server: 1.43.1.10611-1e34174b1
    Also reproduced on 1.43.2.10623-07eb705bc
  • Container: plexinc/pms-docker:plexpass

Crash signature:

traps: Plex Media Scan[N] general protection fault ip:...
  in ld-musl-x86_64.so.1[5a791,...+53000]

Symbol resolution puts file offset 0x5a791 inside __newlocale in the bundled ld-musl-x86_64.so.1. Scanner build ID: f06f07e3c2afdb9da2c389e6b2b975130a3aa1d7


__newlocale call observation:

With a gdb breakpoint on __newlocale, every call leading up to the crash showed:

__newlocale(mask=LC_ALL_MASK, name="", base=NULL)

Without Plex’s debug symbols I can’t say more about why one of them goes wrong.


I ran a script to remove FlagCommentary from my entire media library. I saved a list of files that it got removed from and which track, so that I can revert it later if I choose.

I grep’d the logs from the time the script finished until now, it’s been about 6:45 since that finished and there are no more crashes in the logs. Before I removed the flag, I was seeing about 1.5 crashes per minute.

Edit:

Was researching the flag, found this https://mkvtoolnix.download/doc/NEWS.md if you search ‘commentary’ in 2021 support was added to set the flag, but in Oct. 2025 a change was made for convenience to auto set the flag based on track name.

I am not 100% sure what kind of “commentary” this relates to.

In the case of flagging the content of a stream as being a “commentary”-type of thing:
If I use the GUI version of MKVtoolnix, I can add the “commentary” flag on subtitle and audio streams without them causing crashes in Plex.
I have used this for the last 2–3 years when adding new items, without issues. It is ingested into the Plex DB and appears in the Plex media info. Just as the regular flags for “original language”, “hearing impaired”, and “visual impaired” do.

<Part accessible="1" exists="1" id="1283804" key="/library/parts/1283804/1773503301/file.mkv" duration="5581674" file="J:\Filme4\Rushmore (1998) {tmdb-11545}\Rushmore (1998) {tmdb-11545}.mkv" size="5879582945" container="mkv" deepAnalysisVersion="6" indexes="sd" requiredBandwidths="16463,13398,11257,10118,9684,9305,8649,8649" videoProfile="main">
<Stream id="2191911" streamType="1" default="1" codec="hevc" index="0" bitrate="7787" language="Englisch" languageTag="en" languageCode="eng" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="816" codedWidth="1920" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="23.976" height="816" level="120" profile="main" refFrames="1" requiredBandwidths="10809,7895,5820,4793,4349,3970,3261,3261" width="1920" displayTitle="1080p" extendedDisplayTitle="1080p (HEVC Main)"> </Stream>
<Stream id="2191912" streamType="2" default="1" codec="aac" index="1" channels="2" bitrate="221" language="Deutsch" languageTag="de" languageCode="deu" audioChannelLayout="stereo" profile="lc" requiredBandwidths="222,222,222,222,222,222,222,222" samplingRate="48000" displayTitle="Deutsch (AAC Stereo)" extendedDisplayTitle="Deutsch (AAC Stereo)"> </Stream>
<Stream id="2191913" streamType="2" codec="ac3" index="2" channels="6" bitrate="448" language="Deutsch" languageTag="de" languageCode="deu" audioChannelLayout="5.1(side)" requiredBandwidths="448,448,448,448,448,448,448,448" samplingRate="48000" displayTitle="Deutsch (AC3 5.1)" extendedDisplayTitle="Deutsch (AC3 5.1)"> </Stream>
<Stream id="2191914" streamType="2" selected="1" codec="aac" index="3" channels="2" bitrate="221" language="Englisch" languageTag="en" languageCode="eng" audioChannelLayout="stereo" original="1" profile="lc" requiredBandwidths="222,222,222,222,222,222,222,222" samplingRate="48000" displayTitle="Englisch (AAC Stereo)" extendedDisplayTitle="Englisch (AAC Stereo)"> </Stream>
<Stream id="2191915" streamType="2" codec="dca" index="4" channels="6" bitrate="4276" language="Englisch" languageTag="en" languageCode="eng" audioChannelLayout="5.1(side)" bitDepth="24" original="1" profile="ma" requiredBandwidths="4667,4521,4382,4274,4274,4274,4274,4274" samplingRate="48000" displayTitle="Englisch (DTS-HD MA 5.1)" extendedDisplayTitle="Englisch (DTS-HD MA 5.1)"> </Stream>
<Stream id="2191916" streamType="2" codec="ac3" index="5" channels="2" bitrate="192" language="Englisch" languageTag="en" languageCode="eng" audioChannelLayout="stereo" comment="1" requiredBandwidths="192,192,192,192,192,192,192,192" samplingRate="48000" title="commentary" displayTitle="Englisch (AC3 Stereo)" extendedDisplayTitle="commentary (Englisch AC3 Stereo)"> </Stream>
<Stream id="2191917" streamType="3" canAutoSync="0" codec="srt" index="6" bitrate="0" language="Deutsch" languageTag="de" languageCode="deu" requiredBandwidths="1,1,1,1,1,1,1,1" displayTitle="Deutsch" extendedDisplayTitle="Deutsch (SRT)"> </Stream>
<Stream id="2191918" streamType="3" canAutoSync="0" codec="srt" index="7" bitrate="0" language="Englisch" languageTag="en" languageCode="eng" requiredBandwidths="1,1,1,1,1,1,1,1" displayTitle="Englisch" extendedDisplayTitle="Englisch (SRT)"> </Stream>
<Stream id="2191919" streamType="3" canAutoSync="0" codec="srt" index="8" bitrate="0" language="Englisch" languageTag="en" languageCode="eng" hearingImpaired="1" requiredBandwidths="1,1,1,1,1,1,1,1" displayTitle="Englisch SDH" extendedDisplayTitle="Englisch SDH (SRT)"> </Stream>
<Stream id="2191920" streamType="3" canAutoSync="0" codec="pgs" index="9" bitrate="55" language="Englisch" languageTag="en" languageCode="eng" hearingImpaired="1" requiredBandwidths="90,90,90,90,90,90,90,90" displayTitle="Englisch SDH" extendedDisplayTitle="Englisch SDH (PGS)"> </Stream>
<Stream id="2191921" streamType="3" canAutoSync="0" codec="srt" index="10" bitrate="0" language="Dänisch" languageTag="da" languageCode="dan" requiredBandwidths="1,1,1,1,1,1,1,1" displayTitle="Dänisch" extendedDisplayTitle="Dänisch (SRT)"> </Stream>
</Part>

But maybe I have missed it, if here is another type of commentary flag in the MKV spec.

The issue might also be connected to whether this is a regular MKV flag, or an XML-based flag. I made it a habit of removing all XML flags from my MKV files before adding them into my library. Because these can at times contradict the flags and language definitions of the legacy MKV flags.
XML tags appear like this in the GUI version:

I don’t know what’s crashing it inside that function, can you share any test file with me that has the flag set like you did above, but doesn’t crash the scanner, and I can try it on my plex and see if it does?

I’d suggest that the opposite would be helpful as well. You could provide a sample file which does show the error so that it can be tested by others to confirm your results.

Here’s a test file generated with ffmpeg.
https://www.dropbox.com/t/u4EeyJUg26Q89IDK

Should see it crashes the media scanner.

What I can tell you right away, is that your file does indeed contain XML tags.

Here’s how it was created.

ffmpeg -y -f lavfi -i testsrc=duration=5:size=640x360:rate=24 
-f lavfi -i sine=frequency=440:duration=5 
-c:v libx264 -preset ultrafast -pix_fmt yuv420p 
-c:a aac -b:a 96k flagcommentary-test.mkv

mkvpropedit flagcommentary-test.mkv --edit track:a1 --set flag-commentary=1

That being said, I didn’t experience a crash.
The audio stream was correctly ingested, with the commentary flag present.
But my server is not running Linux, so it might still be a platform-dependent thing.

Please remux the test file with mkvmerge and remove those xml tags. See if it still causes the crash for you. (Just for confirmation puposes.)

The command line parameters for mkvmerge should be
--no-track-tags --no-global-tags

I can confirm it still crashes after removing the tags. The single FlagCommentary=1 bit is enough. You’re not crashing because you are not on linux. Windows doesn’t use musl

Can you still reproduce the crash with this version?

Tested your file, crashed my scanner. Same fault, same address.

kernel: traps: Plex Media Scan general protection fault
in ld-musl-x86_64.so.1[5a791,…+53000]

The musl libc is bundled inside Plex’s Linux Docker container. Windows and macOS Plex don’t ship it, so that code path isn’t reachable on your platform.

Are there any crash dumps?
https://support.plex.tv/articles/201373203-gather-a-process-dump-or-sample-process/

Crash dump:

https://www.dropbox.com/t/0r0PMZy9RiRVpI2J

Also please provide a set of server log files (zipped please), so that it is clear what the server did when the crash occured.

Please enable “debug” log mode, if not already enabled.
Please DISable “verbose” logs.

Logs:

https://www.dropbox.com/t/fjc6ZhWIhoGSK0py

Is the environment a customized or specialized Linux, or is it a regular Linux distribution?
The server startup is unfortunately missing in your logs, so it is not easy to determine.

I’m sorry I sanitized the logs to only include the part around the crash. Also the dump uploader had no logs because I got rate limited by plex, due to frequent crashes in testing.

I’m running the version built for Arrow Lake from this thread:

I am attempting to pull a fresh Plex image to docker on WSL/Ubuntu and reproduce the crash if possible.

Thank you for the data, logs, and dump
I have filed an error report internally.

For what it’s worth, I was able to reproduce the crash on a bare-metal Ubuntu 22.04.5 LTS installation of PMS 1.41.2.10623. For my test, the file was placed in an “Other Video” type library and a manual scan was performed.