Is there an existing issue for this?
Describe the bug
I encountered a rather rare startup race condition between OpenCL background job and dt_wb_presets_init a couple of times in the past days and weeks, see gdb backtrace: darktable_bt_WNW7M3.txt
In darktable.c:1878-1887, the GUI startup path queues OpenCL detection as a background job on the system worker pool and then immediately continues to call dt_wb_presets_init(NULL).
dt_opencl_init (called by a worker thread) loads OpenCL vendor libraries (ICD loader, driver). These vendor libraries are known to call setlocale() internally.
setlocale() in glibc:
- Acquires
__libc_setlocale_lock
- Frees and replaces internal locale data structures (including cached locale strings)
Meanwhile, the main thread is inside dcigettext → guess_category_value → getenv("LANGUAGE"). The glibc dcigettext code is not re-entrant with setlocale(): it caches locale state that can be freed mid-read when setlocale() runs concurrently, leading to a SIGSEGV. This does not happen in the non-GUI/CLI path (init_gui=0) because there dt_opencl_init is called synchronously before dt_wb_presets_init.
Darktable version: 5.5.0+915 (also happened in older versions from git)
OS: Ubuntu 24.04
Steps to reproduce
Start darktable.
I think the crash happened mostly when the system was already quite busy.
Expected behavior
No response
Logfile | Screenshot | Screencast
No response
Commit
No response
Where did you obtain darktable from?
darktable.org / GitHub release
darktable version
5.5.0+915 (also older versions were affected)
What OS are you using?
Linux
What is the version of your OS?
Ubuntu 24.04
Describe your system
System Details Report
Report details
- Date generated: 2026-04-08 15:51:35
Hardware Information:
- Hardware Model: TUXEDO TUXEDO InfinityBook Pro AMD Gen9
- Memory: 32,0 GiB
- Processor: AMD Ryzen™ 7 8845HS w/ Radeon™ 780M Graphics × 16
- Graphics: AMD Radeon™ Graphics
- Disk Capacity: 4,0 TB
Software Information:
- Firmware Version: N.1.14A13
- OS Name: Ubuntu 24.04.4 LTS
- OS Build: (null)
- OS Type: 64-bit
- GNOME Version: 46
- Windowing System: Wayland
- Kernel Version: Linux 6.18.20-061820-generic
Are you using OpenCL GPU in darktable?
Yes
If yes, what is the GPU card and driver?
Radeon 780M iGPU
Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip
No response
Is there an existing issue for this?
Describe the bug
I encountered a rather rare startup race condition between OpenCL background job and
dt_wb_presets_inita couple of times in the past days and weeks, see gdb backtrace: darktable_bt_WNW7M3.txtIn darktable.c:1878-1887, the GUI startup path queues OpenCL detection as a background job on the system worker pool and then immediately continues to call
dt_wb_presets_init(NULL).dt_opencl_init(called by a worker thread) loads OpenCL vendor libraries (ICD loader, driver). These vendor libraries are known to callsetlocale()internally.setlocale()in glibc:__libc_setlocale_lockMeanwhile, the main thread is inside
dcigettext→guess_category_value→getenv("LANGUAGE"). The glibcdcigettextcode is not re-entrant withsetlocale(): it caches locale state that can be freed mid-read whensetlocale()runs concurrently, leading to a SIGSEGV. This does not happen in the non-GUI/CLI path (init_gui=0) because theredt_opencl_initis called synchronously beforedt_wb_presets_init.Darktable version: 5.5.0+915 (also happened in older versions from git)
OS: Ubuntu 24.04
Steps to reproduce
Start darktable.
I think the crash happened mostly when the system was already quite busy.
Expected behavior
No response
Logfile | Screenshot | Screencast
No response
Commit
No response
Where did you obtain darktable from?
darktable.org / GitHub release
darktable version
5.5.0+915 (also older versions were affected)
What OS are you using?
Linux
What is the version of your OS?
Ubuntu 24.04
Describe your system
System Details Report
Report details
Hardware Information:
Software Information:
Are you using OpenCL GPU in darktable?
Yes
If yes, what is the GPU card and driver?
Radeon 780M iGPU
Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip
No response