Re: Abort on exit "libgcc_s.so.1 must be installed for pthread_cancel to work"
On Wed, Apr 10, 2019 at 12:44:27PM +0200, Emmanuel Hocdet wrote: > > Hi Emmanuel, > > > > This bug is caused by libpthread which is not linked with libgcc_s, so it > > tries > > to load libgcc_s during the call to phtread_exit() but that can't work if > > the > > process is chroot'ed. > > > > Your solution is the good one, but it was not working on some > > distributions, I > > add to do ADDLIB="-Wl,--no-as-needed -lgcc_s -Wl,--as-needed" instead. > > > > Regards, > > > > -- > > William Lallemand > > Hi William, > > Thanks for clarifying. It’s annoying… > And --no-as-needed also depend on gcc tools version… > > ++ > Manu For reference: https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_cancel.c;hb=HEAD#l38 When the glibc is generated as a dynamic library, pthread_cancel call the pthread_cancel_init() function. https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/nptl/unwind-forcedunwind.c;hb=HEAD#l53 This function try to load libgcc_s by doing a dlopen. It looks like it's working in some distributions without haproxy being linked to libgcc_s or libpthread linked to libgcc_s, but I didn't find any explicit fix for that. -- William Lallemand
Re: Abort on exit "libgcc_s.so.1 must be installed for pthread_cancel to work"
> Le 5 avr. 2019 à 13:05, William Lallemand a écrit : > > On Fri, Apr 05, 2019 at 12:55:11PM +0200, Emmanuel Hocdet wrote: >> >> Hi, >> >> To test deinit, i come across this: >> >> # /srv/sources/haproxy/haproxy -f /etc/haproxy/ssl.cfg -d -x >> /run/haproxy_ssl.sock -sf 15716 >> >> log on 15716 process: >> Available polling systems : >> epoll : pref=300, test result OK >> poll : pref=200, test result OK >> select : pref=150, test result FAILED >> Total: 3 (2 usable), will use epoll. >> >> Available filters : >> [SPOE] spoe >> [COMP] compression >> [CACHE] cache >> [TRACE] trace >> Using epoll() as the polling mechanism. >> :GLOBAL.accept(0005)=000d from [unix:1] ALPN= >> :GLOBAL.srvcls[adfd:] >> :GLOBAL.clicls[adfd:] >> :GLOBAL.closed[adfd:] >> [WARNING] 094/124050 (15809) : Stopping frontend GLOBAL in 0 ms. >> [WARNING] 094/124050 (15809) : Stopping frontend f-redir in 0 ms. >> [WARNING] 094/124050 (15809) : Stopping backend redir in 0 ms. >> [WARNING] 094/124050 (15809) : Stopping backend varnish in 0 ms. >> [WARNING] 094/124050 (15809) : Proxy GLOBAL stopped (FE: 1 conns, BE: 1 >> conns). >> [WARNING] 094/124050 (15809) : Proxy f-redir stopped (FE: 0 conns, BE: 0 >> conns). >> [WARNING] 094/124050 (15809) : Proxy redir stopped (FE: 0 conns, BE: 0 >> conns). >> [WARNING] 094/124051 (15809) : Proxy varnish stopped (FE: 0 conns, BE: 0 >> conns). >> libgcc_s.so.1 must be installed for pthread_cancel to work >> Aborted >> >> Link with -lgcc_s fix that, and haproxy return with error code 0. >> I think it will be not very portable… >> >> ++ >> Manu >> >> > > Hi Emmanuel, > > This bug is caused by libpthread which is not linked with libgcc_s, so it > tries > to load libgcc_s during the call to phtread_exit() but that can't work if the > process is chroot'ed. > > Your solution is the good one, but it was not working on some distributions, I > add to do ADDLIB="-Wl,--no-as-needed -lgcc_s -Wl,--as-needed" instead. > > Regards, > > -- > William Lallemand Hi William, Thanks for clarifying. It’s annoying… And --no-as-needed also depend on gcc tools version… ++ Manu
Re: Abort on exit "libgcc_s.so.1 must be installed for pthread_cancel to work"
On Fri, Apr 05, 2019 at 12:55:11PM +0200, Emmanuel Hocdet wrote: > > Hi, > > To test deinit, i come across this: > > # /srv/sources/haproxy/haproxy -f /etc/haproxy/ssl.cfg -d -x > /run/haproxy_ssl.sock -sf 15716 > > log on 15716 process: > Available polling systems : > epoll : pref=300, test result OK >poll : pref=200, test result OK > select : pref=150, test result FAILED > Total: 3 (2 usable), will use epoll. > > Available filters : > [SPOE] spoe > [COMP] compression > [CACHE] cache > [TRACE] trace > Using epoll() as the polling mechanism. > :GLOBAL.accept(0005)=000d from [unix:1] ALPN= > :GLOBAL.srvcls[adfd:] > :GLOBAL.clicls[adfd:] > :GLOBAL.closed[adfd:] > [WARNING] 094/124050 (15809) : Stopping frontend GLOBAL in 0 ms. > [WARNING] 094/124050 (15809) : Stopping frontend f-redir in 0 ms. > [WARNING] 094/124050 (15809) : Stopping backend redir in 0 ms. > [WARNING] 094/124050 (15809) : Stopping backend varnish in 0 ms. > [WARNING] 094/124050 (15809) : Proxy GLOBAL stopped (FE: 1 conns, BE: 1 > conns). > [WARNING] 094/124050 (15809) : Proxy f-redir stopped (FE: 0 conns, BE: 0 > conns). > [WARNING] 094/124050 (15809) : Proxy redir stopped (FE: 0 conns, BE: 0 conns). > [WARNING] 094/124051 (15809) : Proxy varnish stopped (FE: 0 conns, BE: 0 > conns). > libgcc_s.so.1 must be installed for pthread_cancel to work > Aborted > > Link with -lgcc_s fix that, and haproxy return with error code 0. > I think it will be not very portable… > > ++ > Manu > > Hi Emmanuel, This bug is caused by libpthread which is not linked with libgcc_s, so it tries to load libgcc_s during the call to phtread_exit() but that can't work if the process is chroot'ed. Your solution is the good one, but it was not working on some distributions, I add to do ADDLIB="-Wl,--no-as-needed -lgcc_s -Wl,--as-needed" instead. Regards, -- William Lallemand
Abort on exit "libgcc_s.so.1 must be installed for pthread_cancel to work"
Hi, To test deinit, i come across this: # /srv/sources/haproxy/haproxy -f /etc/haproxy/ssl.cfg -d -x /run/haproxy_ssl.sock -sf 15716 log on 15716 process: Available polling systems : epoll : pref=300, test result OK poll : pref=200, test result OK select : pref=150, test result FAILED Total: 3 (2 usable), will use epoll. Available filters : [SPOE] spoe [COMP] compression [CACHE] cache [TRACE] trace Using epoll() as the polling mechanism. :GLOBAL.accept(0005)=000d from [unix:1] ALPN= :GLOBAL.srvcls[adfd:] :GLOBAL.clicls[adfd:] :GLOBAL.closed[adfd:] [WARNING] 094/124050 (15809) : Stopping frontend GLOBAL in 0 ms. [WARNING] 094/124050 (15809) : Stopping frontend f-redir in 0 ms. [WARNING] 094/124050 (15809) : Stopping backend redir in 0 ms. [WARNING] 094/124050 (15809) : Stopping backend varnish in 0 ms. [WARNING] 094/124050 (15809) : Proxy GLOBAL stopped (FE: 1 conns, BE: 1 conns). [WARNING] 094/124050 (15809) : Proxy f-redir stopped (FE: 0 conns, BE: 0 conns). [WARNING] 094/124050 (15809) : Proxy redir stopped (FE: 0 conns, BE: 0 conns). [WARNING] 094/124051 (15809) : Proxy varnish stopped (FE: 0 conns, BE: 0 conns). libgcc_s.so.1 must be installed for pthread_cancel to work Aborted Link with -lgcc_s fix that, and haproxy return with error code 0. I think it will be not very portable… ++ Manu