From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B7F3B38618BB; Tue, 1 Jun 2021 09:03:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7F3B38618BB From: "michaldrozd at protonmail dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/100851] New: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library. Date: Tue, 01 Jun 2021 09:03:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: michaldrozd at protonmail dot ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 09:03:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100851 Bug ID: 100851 Summary: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library. Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: michaldrozd at protonmail dot ch Target Milestone: --- Created attachment 50901 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50901&action=3Dedit Code sample to reproduce the issue The provided sample crashes somewhere after exiting from main with the following backtrace (this is the best I could get): Thread 1 "a.out" received signal SIGABRT, Aborted. __restore_sigs (set=3Dset@entry=3D0x7ffe4a7eac00) at ./arch/x86_64/syscall_arch.h:40 40 ./arch/x86_64/syscall_arch.h: No such file or directory. (gdb) bt #0 __restore_sigs (set=3Dset@entry=3D0x7ffe4a7eac00) at ./arch/x86_64/syscall_arch.h:40 #1 0x00007f9b8c44750d in raise (sig=3Dsig@entry=3D6) at src/signal/raise.c:11 #2 0x00007f9b8c41df25 in abort () at src/exit/abort.c:11 #3 0x00007f9b8c22ab53 in __deregister_frame_info_bases () from /usr/lib/libgcc_s.so.1 #4 0x00007f9b8c3d9c5e in __do_global_dtors_aux () from /usr/lib/libpaho-mqtt3cs.so.1 #5 0x000055c817f69294 in test(void*) () #6 0x00007f9b8c497880 in ?? () from /lib/ld-musl-x86_64.so.1 #7 0x00007f9b8c497b48 in builtin_tls () from /lib/ld-musl-x86_64.s= o.1 #8 0x00007f9b8c3f5d97 in ?? () from /usr/lib/libpaho-mqtt3cs.so.1 #9 0x0000000000000000 in ?? () I'm not sure the problem is isolated to the libpaho library, but this is the only one I could reproduce this behaviour with (related libpaho issue repor= t: https://github.com/eclipse/paho.mqtt.c/issues/1110). I've been testing with= the latest libpaho v1.3.9 (https://github.com/eclipse/paho.mqtt.c/releases/tag/v1.3.9), it needs to be compiled and installed with: cmake -DPAHO_WITH_SSL=3DTRUE -DCMAKE_BUILD_TYPE=3DDebug -DCMAKE_INSTALL_PREFIX:PATH=3D/usr -DCMAKE_INSTALL_LIBDIR=3Dlib . make install Both commenting out the std::thread and replacing it with pthread calls make this issue go away. OS: Alpine Linux v3.13 Compiler: gcc (Alpine 10.2.1_pre1) Musl version: musl-1.2.2=