Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libgcc_s.so.1 must be installed for pthread_cancel to work

I'm on python; I am trying to shut down a function running through a ThreadPoolExecutor, but the shutdown is crashing with the error:

libgcc_s.so.1 must be installed for pthread_cancel to work

The function is submitted with:

record_future = self.executor.submit(next,primitive)

primitive is an iterator that usually returns a value but in some cases, it needs to wait a while before returning a value (because of long calculations, etc). In these cases, when I need to shut down the running thread, I cannot wait for the iterator to finish returning, and need to shut it down immediately. I did it with:

executor.shutdown(wait=False)

However, when execution reaches this point, I get the libgcc error.

I tried 'solving' it by manually installing with:

apt-get install libgcc1:amd64

but no dice. I am not sure where exactly python is looking for this library, otherwise I would try creating a symbolic link, because the library is already installed at:

$ /sbin/ldconfig -p | grep libgcc
libgcc_s.so.1 (libc6,x32) => /usr/libx32/libgcc_s.so.1
libgcc_s.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (libc6) => /usr/lib32/libgcc_s.so.1
like image 547
asuprem Avatar asked Mar 02 '23 22:03

asuprem


1 Answers

I found a potential workaround in the Python mailing list to explicitly load libgcc_.so.1 via ctypes as follows:

import ctypes
libgcc_s = ctypes.CDLL('libgcc_s.so.1')

One has to make sure that this is loaded before any threads are created and that the variable libgcc_s lasts until all of the threads are closed (i.e. put this at the beginning of your file).

like image 152
colelemonz Avatar answered Mar 15 '23 11:03

colelemonz