-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
Description
I did this
It's hard to get a MWE. I'll discribe what I've done:
- I'm the maintainer of cygwin target of rust, and recently I've managed to compile
cargotargeting MSYS2 (a variant of cygwin), linking libcurl 8.13.0 and openssl 3.5.0 (dynamically). cargofail silently with SIGSEGV on an anoymous thread exits. Backtrace:
#0 0x0000000000000000 in ?? ()
#1 0x00000001800b2827 in pthread_testcancel () at /d/S/B/src/msys2-runtime/winsup/cygwin/thread.cc:399
#2 pthread_rwlock_wrlock (rwlock=0xa000b73b0) at /d/S/B/src/msys2-runtime/winsup/cygwin/thread.cc:4352
#3 0x000000018019ce44 in _sigfe () at sigfe.s:35
#4 0x0000000435849299 in CRYPTO_THREAD_write_lock () from /usr/bin/msys-crypto-3.dll
#5 0x0000000435835702 in init_thread_remove_handlers () from /usr/bin/msys-crypto-3.dll
#6 0x0000000435835b43 in OPENSSL_thread_stop () from /usr/bin/msys-crypto-3.dll
#7 0x00000005d24bbfdd in DllMain (hinstDLL=<optimized out>, fdwReason=<optimized out>, lpvReserved=<optimized out>) at dllmain.c:74
#8 0x00007ff869351e53 in ntdll!RtlDeactivateActivationContext () from /c/WINDOWS/SYSTEM32/ntdll.dll
#9 0x00007ff8692f2294 in ntdll!LdrShutdownThread () from /c/WINDOWS/SYSTEM32/ntdll.dll
#10 0x00007ff8692f1da6 in ntdll!RtlExitUserThread () from /c/WINDOWS/SYSTEM32/ntdll.dll
#11 0x00000001800c4eb0 in exit_thread (res=res@entry=0) at /d/S/B/src/msys2-runtime/winsup/cygwin/sigproc.cc:587
#12 0x00000001800ab540 in pthread::exit (this=0xa001e6b60, value_ptr=0x0) at /d/S/B/src/msys2-runtime/winsup/cygwin/thread.cc:584
#13 0x00000001800ab333 in pthread::thread_init_wrapper (arg=0xa001e6b60) at /d/S/B/src/msys2-runtime/winsup/cygwin/thread.cc:2016
#14 0x0000000180044841 in pthread_wrapper (arg=<optimized out>) at /d/S/B/src/msys2-runtime/winsup/cygwin/create_posix_thread.cc:79
#15 pthread_wrapper (arg=<optimized out>) at /d/S/B/src/msys2-runtime/winsup/cygwin/create_posix_thread.cc:39
- It turns out that a thread exits and libcurl is detached. It calls OPENSSL_thread_stop and crashes.
- So I looked into the source code and the comment says that it is for statically linked openssl, so I removed this call and compiled again. Now
cargoworks fine.
I expected the following
Well, as it's very hard to construct a MWE, I'm asking experts for help. Could someone explain that whether it is necessary to call OPENSSL_thread_stop if openssl is dynamically linked?
Or, could someone help me to get the clue that, why libcurl is detached when cargo is running?
curl/libcurl version
curl 8.13.0
operating system
MSYS2
Reactions are currently unavailable