Bug 507568 - macOS melt rendering crash at arbitrary frame - EXC_BAD_ACCESS (SIGSEGV)
Summary: macOS melt rendering crash at arbitrary frame - EXC_BAD_ACCESS (SIGSEGV)
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Applications
Component: Rendering & Export (other bugs)
Version First Reported In: 25.04.3
Platform: macOS (DMG) macOS
: NOR crash
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-27 22:53 UTC by rich
Modified: 2025-07-29 10:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
macOS crash log (42.53 KB, text/plain)
2025-07-27 22:53 UTC, rich
Details
another crash log (42.52 KB, text/plain)
2025-07-27 22:56 UTC, rich
Details
much more successful crash log: 32931 frames (42.31 KB, text/plain)
2025-07-27 23:12 UTC, rich
Details
render log for last attempt (1.36 KB, text/plain)
2025-07-27 23:13 UTC, rich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rich 2025-07-27 22:53:34 UTC
Created attachment 183574 [details]
macOS crash log

SUMMARY
kdenlive version 25.04.3
MacOS melt render crash at arbitrary frame number in the same project.
Example below was near the start but have had attempts get >20000 frames in

STEPS TO REPRODUCE
1. The project is 27m19s long, has one main video and audio track and a few non-animated text titles
2. Renders at 37-46 fps until crash
3. I have another project with videos and audio taken from the exact same camera and phone, slightly shorter at 15 minutes, renders every time

OBSERVED RESULT
Crashes arbitrarily, crash log attached

EXPECTED RESULT
No crash

SOFTWARE/OS VERSIONS
macOS: 12.7.6

ADDITIONAL INFORMATION
Render log:
Started render process: /Applications/kdenlive.app/Contents/MacOS/melt -loglevel error -progress2 /private/var/folders/8t/460wy1xj7y1_1ghx0fnk_z0w0000gn/T/kdenlive-tpBwsd-1.mlt
Detected locale "C" with character encoding "US-ASCII", which is not UTF-8. Qt depends on a UTF-8 locale, and has switched to "UTF-8" instead. If this causes problems, reconfigure your locale. See the locale(1) manual for more information.16	492	1
31	983	2
43	1476	3
Rendering of /Users/rich/Documents////Video2-hearing1.mp4 aborted, resulting video will probably be corrupted.
Frame: 1476
Comment 1 rich 2025-07-27 22:56:33 UTC
Created attachment 183576 [details]
another crash log

A second crash log
Comment 2 rich 2025-07-27 23:04:56 UTC
The project has an mp4 (video track, audio removed) and m4a audio track and video track with a couple of title texts
There is only one video clip and one audio clip and an image at the end of the project
Comment 3 rich 2025-07-27 23:12:27 UTC
Created attachment 183578 [details]
much more successful crash log: 32931 frames

Render log ending:

813	32438	66
826	32931	67
Rendering of /Users/rich/Documents////Video2-hearing1.mp4 aborted, resulting video will probably be corrupted.
Frame: 32931
Comment 4 rich 2025-07-27 23:13:15 UTC
Created attachment 183579 [details]
render log for last attempt

Full render log
Comment 5 rich 2025-07-27 23:17:17 UTC
Always seems to crash at a call to localeconv_l

I also get this error in the Job Error Log which seems related:

Detected locale "C" with character encoding "US-ASCII", which is not UTF-8. Qt depends on a UTF-8 locale, and has switched to "UTF-8" instead. If this causes problems, reconfigure your locale. See the locale(1) manual for more information.

How do I set that?
Comment 6 rich 2025-07-28 00:13:26 UTC
It appears the latest kdenlive comes shipped with a blank or incorrect launch environment on macOS causing locale issues.

1. Tried modifying the LaunchAgent: environment.plist - did not work

2. Tried modifying Info.plist in the app bundle and re-signing - did not work

3. Tried supplying the environment directly to the app execution:
LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 /Applications/kdenlive.app/Contents/MacOS/kdenlive

- did not work

Related discussion:
https://discuss.kde.org/t/kdenlive-crashes-while-rendering-on-mac-m2/12821/8
Comment 7 rich 2025-07-28 00:31:54 UTC
The thread suggests it is related to free hard disk space. So I freed several GB of disk space and it crashed faster than ever
Comment 8 rich 2025-07-28 01:10:30 UTC
It doesn't seem to make any difference if I split the one long 25 min clip into two halves on different tracks
Comment 9 Jean-Baptiste Mardelle 2025-07-28 01:47:52 UTC
Git commit e9ce43dcdedf3ac97fb5b198114271c9d7b94d14 by Jean-Baptiste Mardelle.
Committed on 28/07/2025 at 01:47.
Pushed by mardelle into branch 'release/25.08'.

Try to workaround Qt locale issue on Mac

M  +6    -3    renderer/renderjob.cpp
M  +0    -1    renderer/renderjob.h
M  +20   -0    src/main.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/e9ce43dcdedf3ac97fb5b198114271c9d7b94d14
Comment 10 Jean-Baptiste Mardelle 2025-07-28 02:54:06 UTC
Thanks for your detailed report. I just pushed a possible fix for this issue, mostly backported from Shotcut. Could you test the development builds to see if it fixes your problem ? The packages with my patch are available here:
https://cdn.kde.org/ci-builds/multimedia/kdenlive/release-25.08/

Thanks in advance for your feedback
Comment 11 rich 2025-07-28 09:01:00 UTC
With your latest dev build from your link reporting version 25.07.90
And launching from the normal icon

I get the same crash cause but a slightly different error log:
Detected locale "C" with character encoding "US-ASCII", which is not UTF-8. Qt depends on a UTF-8 locale, and has switched to "UTF-8" instead. If this causes problems, reconfigure your locale. See the locale(1) manual for more information.
IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
Comment 12 rich 2025-07-28 09:12:21 UTC
So looks like it is trying to load some metadata using ASCII which has the unicode character "Character Tabulation with Justification (HTJ)" in it.

I also tried launching using "LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 /Applications/kdenlive.app/Contents/MacOS/kdenlive" but still crashed the same way.

I imagine one of my images has an unusual string embedded in it, but doesn't really explain why it crashes arbitrarily unless there is some lazy loading pre-caching going on
Comment 13 rich 2025-07-28 09:26:21 UTC
ChatGPT suggests setting the locale specifically in libmlt:

setlocale(LC_ALL, "en_GB.UTF-8");

I'll try editing the Info.plist
Then a special dylib to see if it fixes it
Comment 14 rich 2025-07-28 10:20:05 UTC
Modifying Info.plist did not fix it

This did fix it:

force_locale.c :

#include <locale.h>
#include <stdlib.h>

__attribute__((constructor))
void force_locale() {
    setenv("LANG", "en_GB.UTF-8", 1);
    setenv("LC_ALL", "en_GB.UTF-8", 1);
    setlocale(LC_ALL, "en_GB.UTF-8");
}


$$ clang -dynamiclib -o force_locale.dylib force_locale.c

$$ DYLD_INSERT_LIBRARIES=$PWD/force_locale.dylib /Applications/kdenlive.app/Contents/MacOS/kdenlive
Comment 15 rich 2025-07-28 10:22:58 UTC
If you can provide another dev build with this fix I will test it with the same project to confim
Comment 16 Jean-Baptiste Mardelle 2025-07-29 06:01:27 UTC
Git commit 7f3b6a2d7b2ce9fd1ebabfaf8b22291daa2600ed by Jean-Baptiste Mardelle.
Committed on 29/07/2025 at 06:01.
Pushed by mardelle into branch 'release/25.08'.

Fix possible locale issue on render in Mac/Windows

M  +6    -3    src/lib/localeHandling.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/7f3b6a2d7b2ce9fd1ebabfaf8b22291daa2600ed
Comment 17 Jean-Baptiste Mardelle 2025-07-29 08:35:04 UTC
Can you please test today's builds that include my latest fix ?
https://cdn.kde.org/ci-builds/multimedia/kdenlive/release-25.08/

Thanks
Comment 18 rich 2025-07-29 10:19:02 UTC
Tested and working, many thanks Jean!!