cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_remove_handle() crashes if called before transfers are complete.

From: Saqib Ali <saqib.ali.75_at_gmail.com>
Date: Tue, 15 Mar 2011 15:54:24 -0400

Thanks for mentioning my name in the test case Daniel!

FYI, I replaced my ssh.c with the file from this location:
https://github.com/bagder/curl/blob/60172a0446bbe3f8bf1c7b066a03b7febfc96ceb/lib/ssh.c
(I
added a few extra infof() calls just to add confidence. you can see them
below prefixed with "---")

Then I did a make clean, make install. Finally, I rebuilt my test and ran
it.
Unfortunately, it crashed again. :(

Below is the backtrace obtained from dbx. It looks like Curl_timeleft() is
trying to operate on a Session Handle that is null.

- Saqib

% dbx myCurlTest
...
Reading Libraries <snipped>
...
Start Block A
* About to connect() to lisvr2 port 22 (#0)
* Trying 10.0.110.51... * 0x5c418 is at send pipe head!
* STATE: CONNECT => WAITCONNECT handle 0x44c20; (connection #0)
* Connected to lisvr2 (10.0.110.51) port 22 (#0)
* SFTP 0x64f58 state change from SSH_STOP to SSH_S_STARTUP
* SFTP 0x64f58 state change from SSH_S_STARTUP to SSH_HOSTKEY
* SFTP 0x64f58 state change from SSH_HOSTKEY to SSH_AUTHLIST
* STATE: WAITCONNECT => PROTOCONNECT handle 0x44c20; (connection #0)
End Block A
Sleeping for 2 seconds!
Start Block C
newEasyHandle = (0x5C418)* Expire cleared
* --- Starting in sftp_done()
* SFTP 0x64f58 state change from SSH_AUTHLIST to SSH_SFTP_CLOSE
* --- Starting in ssh_done()
* --- Starting in ssh_easy_statemach()
* SFTP DONE done
* SFTP 0x64f58 state change from SSH_SFTP_CLOSE to SSH_STOP
t_at_1 (l_at_1) signal SEGV (no mapping at the fault address) in Curl_timeleft at
line 145 in file "connect.c"
  145 if(data->set.timeout > 0)
(dbx) where
current thread: t_at_1
=>[1] Curl_timeleft(conn = 0x5c418, nowp = (nil), duringconnect =
bool_false), line 145 in "connect.c"
  [2] ssh_easy_statemach(conn = 0x64ba0, duringconnect = bool_false), line
2480 in "ssh.c"
  [3] ssh_done(conn = 0x64ba0, status = CURLE_OK), line 2758 in "ssh.c"
  [4] sftp_done(conn = 0x64ba0, status = CURLE_OK, premature = bool_true),
line 2928 in "ssh.c"
  [5] Curl_done(connp = 0x44c2c, status = CURLE_OK, premature = bool_true),
line 5200 in "url.c"
  [6] curl_multi_remove_handle(multi_handle = 0x43850, curl_handle =
0x5c418), line 684 in "multi.c"
  [7] main() (optimized), at 0x114e4 (line ~51) in "myCurlTest.C"
(dbx) display data
data = (nil)

On Sat, Mar 12, 2011 at 6:27 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Fri, 11 Mar 2011, Saqib Ali wrote:
>
> Good to know I'm not going totally insane.
>>
>
> I found it and I fixed it. I committed the fixes and I added a test case
> (583) that hopefully now will verify that this keeps working. Try it out and
> see if it works for you or if you find something else...!
>
> --
>
> / daniel.haxx.se
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-15