pycurl multi thread problem

Problem:

longjmp causes uninitialized stack frame : python terminated

======= Backtrace: =========

/lib64/libc.so.6(__fortify_fail+0x37)[0x7f2752368d47]

/lib64/libc.so.6(+0x101cd9)[0x7f2752368cd9]

/lib64/libc.so.6(__longjmp_chk+0x33)[0x7f2752368c43]

/usr/lib64/libcurl.so.4(+0xeb25)[0x7f274bf80b25]

/lib64/libpthread.so.0(+0xf500)[0x7f2752c94500]

/lib64/libc.so.6(__select+0x33)[0x7f2752347d03]

/usr/lib64/python2.6/lib-dynload/timemodule.so(+0x2219)[0x7f27481ef219]

/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x5244)[0x7f2752f80b24]

/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x927)[0x7f2752f82797]

/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f2752f82872]

/usr/lib64/libpython2.6.so.1.0(+0xfbbbc)[0x7f2752f9dbbc]

/usr/lib64/libpython2.6.so.1.0(PyRun_FileExFlags+0x90)[0x7f2752f9dc90]

/usr/lib64/libpython2.6.so.1.0(PyRun_SimpleFileExFlags+0xdc)[0x7f2752f9f17c]

/usr/lib64/libpython2.6.so.1.0(Py_Main+0xb62)[0x7f2752fabc32]

/lib64/libc.so.6(__libc_start_main+0xfd)[0x7f2752285cdd]

python[0x400649]

======= Memory map: ========

00400000-00401000 r-xp 00000000 ca:01 1258 /usr/bin/python

00600000-00601000 rw-p 00000000 ca:01 1258 /usr/bin/python

00bd0000-00d34000 rw-p 00000000 00:00 0 [heap]
 

 

Solution:

c = pycurl.Curl()

c.setopt(pycurl.URL, ‘www.baidu.com’)

c.setopt(pycurl.FOLLOWLOCATION, 1)

c.setopt(pycurl.NOSIGNAL, 1) #need to add

c.setopt(pycurl.TIMEOUT, 1)
Reason:

This will tell libcurl not to use any signal related code that causes in a multithreaded python script this kind of error.