Kicad UCRT64 locks up when running Plugin and Content Manager (PCM); regex related
Description / Steps to reproduce the issue
Open KiCad under UCRT64 From Tools Menu Tools -> Plugin and Content Manager
Expected behavior
The PCM fetching window to open.
Actual behavior
The program stops responding
Verification
- [X] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)
Windows Version
MINGW64_NT-10.0-19045
MINGW environments affected
- [X] UCRT64
Are you willing to submit a PR?
Yes
Edit: This patch is not a proper fix!
Patch that stops the locking up for me in my fork .
---
thirdparty/json_schema_validator/json-validator.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/thirdparty/json_schema_validator/json-validator.cpp b/thirdparty/json_schema_validator/json-validator.cpp
index 05d0a9503d..a2ec6c3e7a 100644
--- a/thirdparty/json_schema_validator/json-validator.cpp
+++ b/thirdparty/json_schema_validator/json-validator.cpp
@@ -23,6 +23,13 @@ using nlohmann::json_uri;
using nlohmann::json_schema::root_schema;
using namespace nlohmann::json_schema;
+#if defined(__MINGW32__) && defined(_UCRT)
+// MSys2 MinGW UCRT64 locks when using REGEX in this file.
+// Using Plugin Content Manager (PCM) triggers the lock up.
+ #undef JSON_SCHEMA_BOOST_REGEX
+ #define JSON_SCHEMA_NO_REGEX 1
+#endif
+
#ifdef JSON_SCHEMA_BOOST_REGEX
# include <boost/regex.hpp>
# define REGEX_NAMESPACE boost
--
Possibly related to https://github.com/Exiv2/exiv2/issues/2831 ? @lb90
Does it occur in CLANG64 w/ libc++?
Possibly related to Exiv2/exiv2#2831 ? @lb90
Does it occur in CLANG64 w/ libc++?
No, the lockup problem is not in either CLANG64 or MINGW64 MSys2 standard builds. Edit: I did not see the problem under MINGW32 in my fork, either.
And, the problem does seem very similar to GNOME reports here
Tim S.
Possibly related to Exiv2/exiv2#2831 ?
Most probably yes. @stahta01 could you get a stacktrace of all running threads when kicad stops responding? To do that open an MSYS2 UCRT64 shell and run:
gdb -p [PID of kicad.exe]
thread apply all bt
quit
Possibly related to Exiv2/exiv2#2831 ?
Most probably yes. @stahta01 could you get a stacktrace of all running threads when kicad stops responding? To do that open an MSYS2 UCRT64 shell and run:
gdb -p [PID of kicad.exe] thread apply all bt quit
Thank for the info on how to get the information; I will try when I get the current builds done; my PC is slow and I do not wish to risk have to re-run the builds.
Note to self: When using the ps command use WINPID with gdb.
Tim S.
Reading symbols from C:\msys64\ucrt64\bin\kicad.exe...
(No debugging symbols found in C:\msys64\ucrt64\bin\kicad.exe)
(gdb) thread apply all bt
Thread 5 (Thread 5924.0xed0):
#0 0x00007ffff6130b11 in ntdll!DbgBreakPoint () from C:\WINDOWS\SYSTEM32\ntdll.dll
#1 0x00007ffff615ca0e in ntdll!DbgUiRemoteBreakin () from C:\WINDOWS\SYSTEM32\ntdll.dll
#2 0x00007ffff5587344 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
#3 0x00007ffff60e26b1 in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
#4 0x0000000000000000 in ?? ()
Thread 4 (Thread 5924.0xb10):
#0 0x00007ffff6130a74 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SYSTEM32\ntdll.dll
#1 0x00007ffff60e2e27 in ntdll!TpReleaseCleanupGroupMembers () from C:\WINDOWS\SYSTEM32\ntdll.dll
#2 0x00007ffff5587344 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
#3 0x00007ffff60e26b1 in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
#4 0x0000000000000000 in ?? ()
Thread 3 (Thread 5924.0xe80):
#0 0x00007ffff6130a74 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SYSTEM32\ntdll.dll
#1 0x00007ffff60e2e27 in ntdll!TpReleaseCleanupGroupMembers () from C:\WINDOWS\SYSTEM32\ntdll.dll
#2 0x00007ffff5587344 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
#3 0x00007ffff60e26b1 in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
#4 0x0000000000000000 in ?? ()
Thread 2 (Thread 5924.0x1534):
#0 0x00007ffff612d104 in ntdll!ZwRemoveIoCompletion () from C:\WINDOWS\SYSTEM32\ntdll.dll
#1 0x00007ffff393452f in KERNELBASE!GetQueuedCompletionStatus () from C:\WINDOWS\System32\KernelBase.dll
#2 0x00007fffc4180f36 in ?? () from C:\msys64\ucrt64\bin\wxbase32u_gcc_custom.dll
#3 0x00007fffc41828a8 in ?? () from C:\msys64\ucrt64\bin\wxbase32u_gcc_custom.dll
--Type <RET> for more, q to quit, c to continue without paging--c
#4 0x00007fffc41669ad in ?? () from C:\msys64\ucrt64\bin\wxbase32u_gcc_custom.dll
#5 0x00007fffc4166b13 in ?? () from C:\msys64\ucrt64\bin\wxbase32u_gcc_custom.dll
#6 0x00007ffff3801bb2 in ucrtbase!_configthreadlocale () from C:\WINDOWS\System32\ucrtbase.dll
#7 0x00007ffff5587344 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
#8 0x00007ffff60e26b1 in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
#9 0x0000000000000000 in ?? ()
Thread 1 (Thread 5924.0x2604):
#0 0x00007ffff3828d75 in ucrtbase!memmove () from C:\WINDOWS\System32\ucrtbase.dll
#1 0x00007fffcbf3422e in ?? () from C:\msys64\ucrt64\bin\libstdc++-6.dll
#2 0x00007fffcbf34026 in ?? () from C:\msys64\ucrt64\bin\libstdc++-6.dll
#3 0x00007fffcbe84366 in ?? () from C:\msys64\ucrt64\bin\libstdc++-6.dll
#4 0x00007ff63652f8d9 in kicad!NoHotPatch ()
#5 0x00007ff636538425 in kicad!NoHotPatch ()
#6 0x00007ff636537f33 in kicad!NoHotPatch ()
#7 0x00007ff6365361a8 in kicad!NoHotPatch ()
#8 0x00007ff636536127 in kicad!NoHotPatch ()
#9 0x00007ff6365363fb in kicad!NoHotPatch ()
#10 0x00007ff63653aa79 in kicad!NoHotPatch ()
#11 0x00007ff636419d6b in kicad!NoHotPatch ()
#12 0x00007ff636411b1c in kicad!NoHotPatch ()
#13 0x00007ff636414f89 in kicad!NoHotPatch ()
#14 0x00007ff6364173a6 in kicad!NoHotPatch ()
#15 0x00007ff6364197c2 in kicad!NoHotPatch ()
#16 0x00007ff636411b1c in kicad!NoHotPatch ()
#17 0x00007ff636414f89 in kicad!NoHotPatch ()
#18 0x00007ff6364173a6 in kicad!NoHotPatch ()
#19 0x00007ff636416c39 in kicad!NoHotPatch ()
#20 0x00007ff636480d9f in kicad!NoHotPatch ()
#21 0x00007ff636418af1 in kicad!NoHotPatch ()
#22 0x00007ff636346dbf in ?? ()
#23 0x00007ff63601eb39 in ?? ()
#24 0x00007ff636050808 in ?? ()
#25 0x00007ff6364b8ab0 in kicad!NoHotPatch ()
#26 0x00007ff63617dc3a in ?? ()
#27 0x0000000000000000 in ?? ()
Thanks for the feedback! Yes, it's the same underlying issue in libstdc++. I'm going to prepare a fix tomorrow!
Ok, I have a patch, but I need to know how to correctly encode strings to UTF-16: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98723#c8
What is the original encoding of the strings? Maybe, one of the conversion functions from the STL would work? https://en.cppreference.com/w/cpp/string/multibyte