https://bugs.documentfoundation.org/show_bug.cgi?id=174406
Bug ID: 174406
Summary: Windows: hang on startup with Turkish locale –
std::locale "bad locale name" for "Turkish_Türkiye"
triggers crash handler, which deadlocks
Product: LibreOffice
Version: 26.8.2.2 release
Hardware: x86-64 (AMD64)
OS: Windows (All)
Status: UNCONFIRMED
Severity: minor
Priority: medium
Component: LibreOffice
Assignee: [email protected]
Reporter: [email protected]
Description:
Environment
-----------
- LibreOffice 26.8.2.2 (x64), Windows 11 Pro build 26300
- Windows display language / format / system locale: tr-TR
- System ANSI code page: 1254 (the "Beta: Use Unicode UTF-8" option is NOT
enabled)
- LibreOffice UI locale (ooLocale): "tr"
Steps to reproduce
------------------
1. Use Windows with Turkish (tr-TR) regional settings.
2. Install LibreOffice 26.8.2.2 with Turkish UI.
3. Open any document (e.g. an empty .odt) or start Writer.
Actual result
-------------
The window stays blank and Windows marks it "Not Responding". The process
never crashes and never recovers; it has to be killed. This happens every time.
Expected result
---------------
Writer opens normally.
Analysis (from two full process dumps taken with Task Manager)
--------------------------------------------------------------
Both dumps show the same state. No PDBs were available, so frames are
identified by module offsets, exports and string references in mergedlo.dll.
Main thread (30768):
... SfxFrame / SfxBaseController / framework::LayoutManager
-> vcl window decoration (code references SV_HELPTEXT_CLOSEDOCUMENT,
SV_HELPTEXT_RESTORE, SV_HELPTEXT_MINIMIZE -> translated UI strings)
-> locale generation code (references "bad locale name", "UTF-8",
"windows-1252", "ISO8859-1" -> looks like boost::locale / Translate)
-> MSVCP140 std::_Locinfo::_Locinfo(int, const char*) / std::locale::_Init
-> error path -> RtlCaptureContext, GetCurrentThreadId,
ReleaseSemaphore, WaitForSingleObject (mergedlo.dll+0x495e149)
i.e. the in-process crash handler is asked to write a minidump and the
main thread waits for it.
Strings found on the main thread stack:
"tr_TR.UTF-8", "Turkish_Türkiye.1254", "tr_TR.utf8", "tr_TR.UTF-8",
"message_"
Crash handler thread (6900):
dbgcore.dll (MiniDumpWriteDump) -> ucrtbase -> ntdll RtlEnterCriticalSection
It is blocked on a CRT lock (ucrtbase+0x139960). The most likely holder is
the main thread, which is still inside the CRT locale code when the error
happens. Result: a deadlock instead of a crash, so the crash reporter
never runs and nothing gets reported.
Root cause (verified directly against ucrtbase.dll on the same machine)
-----------------------------------------------------------------------
Recent Windows versions name the Turkish locale "Turkish_Türkiye" (formerly
"Turkish_Turkey"). The name contains a non-ASCII character, and the UCRT
cannot reliably feed back the name it returned itself:
setlocale(LC_ALL, "") -> "Turkish_T\xfcrkiye.1254" (cp1254 bytes)
setlocale(LC_ALL, ".UTF-8") -> "Turkish_T\xc3\xbcrkiye.utf8" (UTF-8 bytes)
setlocale(LC_ALL, <same name>) -> OK (while the UTF-8 locale is active)
setlocale(LC_ALL, "C")
setlocale(LC_ALL, "Turkish_T\xc3\xbcrkiye.utf8") -> NULL (fails)
setlocale(LC_ALL, "Turkish_Turkey.1254") -> NULL (old name gone)
So a std::locale whose name was captured under a UTF-8 locale cannot be
recreated by name under a non-UTF-8 locale (and the reverse). std::locale
then throws std::runtime_error("bad locale name"). Somewhere on this path the
error is not handled and goes to the crash handler, which then deadlocks as
described above.
Minimal C/C++ reproduction of the UCRT behaviour (Turkish Windows):
#include <clocale>
#include <cstdio>
#include <cstring>
int main() {
char name[256];
std::strcpy(name, std::setlocale(LC_ALL, ".UTF-8"));
std::setlocale(LC_ALL, "C");
std::printf("%s -> %s\n", name,
std::setlocale(LC_ALL, name) ? "ok" : "FAILS");
}
Two separate problems
---------------------
1. Locale names with non-ASCII characters (Turkish_Türkiye) make the
boost::locale / std::locale path fail on Turkish Windows. It should either
handle this or fall back gracefully, e.g. use the classic locale instead
of throwing.
2. The crash handler can deadlock when the failure happens inside CRT locale
code (the dump-writer thread needs a CRT lock the faulting thread holds).
This turns a crash into a permanent hang and hides the crash report.
Workaround
----------
Changing the LibreOffice UI language to English (ooLocale = en-US in
registrymodifications.xcu) avoids the Turkish locale path.
Dumps
-----
Two full-memory dumps (~950 MB each) are available on request. They are not
attached because of their size and because they contain process memory.
Steps to Reproduce:
1. Use Windows 11 with Turkish (tr-TR) display language, regional format and
system locale (ANSI code page 1254).
2. Install LibreOffice 26.8.2.2 x64 with the Turkish UI (ooLocale = "tr").
3. Open any document (e.g. an empty .odt) or start Writer.
Actual Results:
The window stays blank and Windows marks it "Not Responding". The process never
crashes and never recovers; it has to be killed from Task Manager. No crash
report is produced.
Expected Results:
Writer opens normally. Even if the locale error happens, it should be handled
(or at worst lead to a crash with a crash report), not a permanent hang.
Reproducible: Always
User Profile Reset: No
Additional Info:
Help > About is not reachable because the application hangs before the UI
appears.
Version taken from the binaries: LibreOffice 26.8.2.2 (x64), soffice.bin /
mergedlo.dll file version 26.8.2.2.
OS: Windows 11 Pro build 26300 (x64).
Locale: tr-TR (UI, format and system locale), ACP 1254, the "Beta: Use Unicode
UTF-8" option is disabled.
Relevant modules loaded at the time of the hang: skialo.dll, nvopencl64.dll
(NVIDIA OpenCL), LanguageToollo.dll, pyuno/python313. Their threads were idle
and do not appear to be involved.
--
You are receiving this mail because:
You are the assignee for the bug.