使用libcurl的应用程序在同一点随机崩溃

时间:2016-03-18 21:29:16

标签: c++ curl libcurl

我有使用libcurl库的应用程序(嵌入式平台的自定义构建)。它在同一点随机崩溃。请看下面的摘要。

(gdb) bt full
#0  ssh_getworkingpath (conn=conn@entry=0x101fea88, homedir=<optimized out>, 
    path=path@entry=0x0)
    at /home/mdoody/svn/trunk/ws1/UniRan/build_unirangpp/tmp/work/ppce500v2-pw_uniran-linux-gnuspe/curl/7.44.0-r2/curl-7.44.0/lib/ssh.c:461
        data = <optimized out>
        real_path = 0x101f05f8 "/cores/10002088-bbp.core.lteLayer2.1458229548.1462.gz"
        working_path = 0x101ff528 "/cores/10002088-bbp.core.lteLayer2.1458229548.1462.gz"
        working_path_len = 53
#1  0x0fa61f18 in ssh_statemach_act (conn=conn@entry=0x101fea88, 
    block=block@entry=0xbf8e4488)
    at /home/mdoody/svn/trunk/ws1/UniRan/build_unirangpp/tmp/work/ppce500v2-pw_uniran-linux-gnuspe/curl/7.44.0-r2/curl-7.44.0/lib/ssh.c:1170
        result = CURLE_OK
        data = 0x10204a18
        sftp_scp = 0x0
        sshc = 0x101fee48
        sock = 13
        new_readdir_line = <optimized out>
        rc = 0
        err = <optimized out>
        seekerr = 0
---Type <return> to continue, or q <return> to quit---
        __PRETTY_FUNCTION__ = "ssh_statemach_act"
#2  0x0fa65070 in ssh_multi_statemach (conn=conn@entry=0x101fea88, done=0x0, 
    done@entry=0xbf8e4501)
    at /home/mdoody/svn/trunk/ws1/UniRan/build_unirangpp/tmp/work/ppce500v2-pw_uniran-linux-gnuspe/curl/7.44.0-r2/curl-7.44.0/lib/ssh.c:2699
        sshc = 0x101fee48
        result = CURLE_OK
        block = false
#3  0x0fa656a0 in sftp_perform (dophase_done=<optimized out>, 
    connected=<optimized out>, conn=<optimized out>)
    at /home/mdoody/svn/trunk/ws1/UniRan/build_unirangpp/tmp/work/ppce500v2-pw_uniran-linux-gnuspe/curl/7.44.0-r2/curl-7.44.0/lib/ssh.c:3075
        result = <optimized out>
#4  ssh_do (conn=0x101fea88, done=0xbf8e4501)
    at /home/mdoody/svn/trunk/ws1/UniRan/build_unirangpp/tmp/work/ppce500v2-pw_uniran-linux-gnuspe/curl/7.44.0-r2/curl-7.44.0/lib/ssh.c:2930
        result = <optimized out>
        connected = false
        data = <optimized out>
        sshc = 0x101fee48
#5  0x0fa48d04 in Curl_do (connp=<optimized out>, done=<optimized out>)

查看跟踪它似乎正在尝试将空指针放在库中的某些位置。如果查看堆栈,您可以看到它最后执行的行号。那是在“7.44.0 / lib / ssh.c:461”行。查看源代码,我无法确定问题所在。我将感谢你的帮助。我正在使用curl_multihandel,根据需要添加和删除几个简单的句柄。

查看更详细的框架结构我可以说“protop”字段为空并且已连线。

// connection
(gdb) f 0
#0  ssh_getworkingpath (conn=conn@entry=0x101fea88, homedir=<optimized out>, path=path@entry=0x0)
    at /home/mdoody/svn/trunk/ws1/UniRan/build_unirangpp/tmp/work/ppce500v2-pw_uniran-linux-gnuspe/curl/7.44.0-r2/curl-7.44.0/lib/ssh.c:461
461 in /home/mdoody/svn/trunk/ws1/UniRan/build_unirangpp/tmp/work/ppce500v2-pw_uniran-linux-gnuspe/curl/7.44.0-r2/curl-7.44.0/lib/ssh.c
(gdb) p conn->data->mstate
$55 = CURLM_STATE_DO
(gdb) p conn->data->req.protop
$56 = (void *) 0x0
(gdb) p conn->data->result    
$57 = CURLE_OK
(gdb) p conn->data->multi 
$58 = (struct Curl_multi *) 0x101d2160

(gdb) p *conn->data->multi
$65 = {type = 764702, easyp = 0x10204a18, easylp = 0x10204a18, num_easy = 1, num_alive = 1, msglist = 0x101dd0e8, pending = 0x101dd110, socket_cb = 0x0, 
  socket_userp = 0x0, push_cb = 0x0, push_userp = 0x0, hostcache = {table = 0x101d2238, hash_func = 0xfa573a4 <Curl_hash_str>, 
    comp_func = 0xfa5740c <Curl_str_key_compare>, dtor = 0xfa2d424 <freednsentry>, slots = 7, size = 0}, timetree = 0x1020d068, sockhash = {table = 0x101d2380, 
    hash_func = 0xfa5752c <hash_fd>, comp_func = 0xfa57514 <fd_key_compare>, dtor = 0xfa578e0 <sh_freeentry>, slots = 911, size = 0}, pipelining = 0, 
  recheckstate = false, conn_cache = {hash = {table = 0x101dc028, hash_func = 0xfa573a4 <Curl_hash_str>, comp_func = 0xfa5740c <Curl_str_key_compare>, 
      dtor = 0xfa75788 <free_bundle_hash_entry>, slots = 97, size = 1}, num_connections = 1, next_connection_id = 17, last_cleanup = {tv_sec = 1101, tv_usec = 306014}}, 
  closure_handle = 0x101dd138, maxconnects = -1, max_host_connections = 0, max_total_connections = 0, max_pipeline_length = 5, content_length_penalty_size = 0, 
  chunk_length_penalty_size = 0, pipelining_site_bl = 0x0, pipelining_server_bl = 0x0, timer_cb = 0x0, timer_userp = 0x0, timer_lastcall = {tv_sec = 0, tv_usec = 0}}

// ssh
(gdb) f 1
(gdb) p sshc->state
$68 = SSH_SFTP_QUOTE_INIT
(gdb) p sftp_scp
$72 = (struct SSHPROTO *) 0x0
(gdb) p *sshc
$70 = {authlist = 0x101ff0d8 "publickey,gssapi-keyex,gssapi-with-mic,password", passphrase = 0xfa8af9c "", rsa_pub = 0x0, rsa = 0x0, authed = true, 
  state = SSH_SFTP_QUOTE_INIT, nextstate = SSH_NO_STATE, actualcode = CURLE_OK, quote_item = 0x0, quote_path1 = 0x0, quote_path2 = 0x0, quote_attrs = {flags = 0, 
    filesize = 0, uid = 0, gid = 0, permissions = 0, atime = 0, mtime = 0}, acceptfail = false, homedir = 0x1021c140 "/", readdir_attrs = {flags = 0, filesize = 0, 
    uid = 0, gid = 0, permissions = 0, atime = 0, mtime = 0}, readdir_filename = 0x0, readdir_longentry = 0x0, readdir_len = 0, readdir_totalLen = 0, 
  readdir_currLen = 0, readdir_line = 0x0, readdir_linkPath = 0x0, secondCreateDirs = 0, slash_pos = 0x0, ssh_session = 0x1020d1b8, ssh_channel = 0x0, 
  sftp_session = 0x10201088, sftp_handle = 0x0, orig_waitfor = 2, ssh_agent = 0x0, sshagent_identity = 0x0, sshagent_prev_identity = 0x0, kh = 0x0}

当发生此崩溃并尝试获取工作路径时,我们处于SSH_SFTP_QUOTE_INIT中。如果你能帮我解决为什么“Session handeler”中的“protop”字段为NULL?当调用多句柄时,它以正确的格式传递。

先谢谢!!!!

0 个答案:

没有答案