2月 092022
 

缘起:

一个PHP进程本来看不到使用任何的多线程方法,但是,strace时却发现大量的clone调用,而且,ps时,还发现进程状态是Sl 的,随不解,gdb 探查之,发现如下堆栈:

为什么一个简单的域名解析还需要劳驾线程呢?

寻找参考资料:

多线程中使用curl致coredump问题 – 云+社区 – 腾讯云 (tencent.com)

 

对于多线程的环境,libcurl如果使用 SIGALARM 来实现dns的查询超时控制的话,会有问题,所以,会考虑使用线程的方式来实现。

但是,对于PHP这种单线程环境来讲,使用SIGALARM 也没有问题。

libcurl编译时使用 –enable-ares 来避免使用线程做域名解析

 

 Posted by at 下午 3:48

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据