public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100851] New: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library.
@ 2021-06-01  9:03 michaldrozd at protonmail dot ch
  2021-09-09  6:36 ` [Bug libstdc++/100851] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: michaldrozd at protonmail dot ch @ 2021-06-01  9:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100851

            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=50901&action=edit
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=set@entry=0x7ffe4a7eac00) 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=set@entry=0x7ffe4a7eac00) at
./arch/x86_64/syscall_arch.h:40
        #1  0x00007f9b8c44750d in raise (sig=sig@entry=6) 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.so.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 report:
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=TRUE -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR=lib .
        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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/100851] Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library.
  2021-06-01  9:03 [Bug libstdc++/100851] New: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library michaldrozd at protonmail dot ch
@ 2021-09-09  6:36 ` pinskia at gcc dot gnu.org
  2021-09-09  6:38 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-09  6:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100851

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 91737.

*** This bug has been marked as a duplicate of bug 91737 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/100851] Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library.
  2021-06-01  9:03 [Bug libstdc++/100851] New: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library michaldrozd at protonmail dot ch
  2021-09-09  6:36 ` [Bug libstdc++/100851] " pinskia at gcc dot gnu.org
@ 2021-09-09  6:38 ` pinskia at gcc dot gnu.org
  2021-09-09  6:38 ` pinskia at gcc dot gnu.org
  2021-09-09  8:03 ` michaldrozd at protonmail dot ch
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-09  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100851

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |---

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Or maybe not.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/100851] Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library.
  2021-06-01  9:03 [Bug libstdc++/100851] New: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library michaldrozd at protonmail dot ch
  2021-09-09  6:36 ` [Bug libstdc++/100851] " pinskia at gcc dot gnu.org
  2021-09-09  6:38 ` pinskia at gcc dot gnu.org
@ 2021-09-09  6:38 ` pinskia at gcc dot gnu.org
  2021-09-09  8:03 ` michaldrozd at protonmail dot ch
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-09  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100851

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=91737

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Or maybe it was caused by PR 91737.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/100851] Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library.
  2021-06-01  9:03 [Bug libstdc++/100851] New: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library michaldrozd at protonmail dot ch
                   ` (2 preceding siblings ...)
  2021-09-09  6:38 ` pinskia at gcc dot gnu.org
@ 2021-09-09  8:03 ` michaldrozd at protonmail dot ch
  3 siblings, 0 replies; 5+ messages in thread
From: michaldrozd at protonmail dot ch @ 2021-09-09  8:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100851

--- Comment #4 from michaldrozd at protonmail dot ch ---
PR 91737 seems similar enough to be related
I've narrowed it down to the -Wl,-init functionality, if you comment out this
lines it exits cleanly.
https://github.com/eclipse/paho.mqtt.c/blob/master/src/CMakeLists.txt#L220
Interestingly enough if you edit the function
https://github.com/eclipse/paho.mqtt.c/blob/master/src/MQTTClient.c#L119 to do
absolutely nothing it still aborts, so it seems it's something with the init
functionality itself, not this specific function

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-09  8:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01  9:03 [Bug libstdc++/100851] New: Using std::thread on Alpine Linux/musl causes SIGABRT after main when unloading a shared library michaldrozd at protonmail dot ch
2021-09-09  6:36 ` [Bug libstdc++/100851] " pinskia at gcc dot gnu.org
2021-09-09  6:38 ` pinskia at gcc dot gnu.org
2021-09-09  6:38 ` pinskia at gcc dot gnu.org
2021-09-09  8:03 ` michaldrozd at protonmail dot ch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).