小编Mog*_*wai的帖子

libcurl中的分段错误,多线程

所以我有一堆工作线程做简单的curl类,每个工作线程都有自己的curl easy handle.他们只在随机网站上进行HEAD查找.此外,还存在锁定功能以启用多线程SSL,如此处所述.一切正常,除了2个网页ilsole24ore.com(见例下)和ninemsn.com.au/,它们有时会产生seg故障,如此处所示的跟踪输出所示

 #0  *__GI___libc_res_nquery (statp=0xb4d12df4, name=0x849e9bd "ilsole24ore.com", class=1, type=1, answer=0xb4d0ca10 "", anslen=1024, answerp=0xb4d0d234,
        answerp2=0x0, nanswerp2=0x0, resplen2=0x0) at res_query.c:182
    #1  0x00434e8b in __libc_res_nquerydomain (statp=0xb4d12df4, name=0xb4d0ca10 "", domain=0x0, class=1, type=1, answer=0xb4d0ca10 "", anslen=1024,
        answerp=0xb4d0d234, answerp2=0x0, nanswerp2=0x0, resplen2=0x0) at res_query.c:576
    #2  0x004352b5 in *__GI___libc_res_nsearch (statp=0xb4d12df4, name=0x849e9bd "ilsole24ore.com", class=1, type=1, answer=0xb4d0ca10 "", anslen=1024,
        answerp=0xb4d0d234, answerp2=0x0, nanswerp2=0x0, resplen2=0x0) at res_query.c:377
    #3  0x009c0bd6 in *__GI__nss_dns_gethostbyname3_r (name=0x849e9bd "ilsole24ore.com", af=2, result=0xb4d0d5fc, buffer=0xb4d0d300 "\177", buflen=512,
        errnop=0xb4d12b30, h_errnop=0xb4d0d614, ttlp=0x0, canonp=0x0) at nss_dns/dns-host.c:197
    #4  0x009c0f2b in _nss_dns_gethostbyname2_r (name=0x849e9bd …
Run Code Online (Sandbox Code Playgroud)

c curl pthreads segmentation-fault

7
推荐指数
1
解决办法
9909
查看次数

标签 统计

c ×1

curl ×1

pthreads ×1

segmentation-fault ×1