文章标签 » pycurl

多线程使用pycurl时出现段错误(segmentation fault)

http://www.python-forum.org/pythonforum/viewtopic.php?f=5&t=9395

只需要加一个选项

client.setopt(pycurl.NOSIGNAL, 1)

文档的解释

Pass a long. If it is 1, libcurl will not use any functions that install signal handlers or any functions that cause signals to be sent to the process. This option is mainly here to allow multi-threaded unix applications to still set/use all timeout options etc, without risking getting signals. (Added in 7.10)

If this option is set and libcurl has been built with the standard name resolver, timeouts will not occur while the name resolve takes place. Consider building libcurl with c-ares support to enable asynchronous DNS lookups, which enables nice timeouts for name resolves without signals.