cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: adding easy handles when using curl_multi_socket*

From: <koettermarkus_at_gmx.de>
Date: Tue, 29 Apr 2008 12:55:57 +0200

I added some more debug got a backtrace and a got a guess whats going wrong.

break load.c:183

curl 7.18.1

load.c:91 Event on socket 8 (READ)
load.c:94 looping in event_callback
load.c:109 rc is 0
load.c:91 Event on socket 8 (READ)

> we got a read event

load.c:94 looping in event_callback
load.c:140 Callback on socket 8 (REMOVE)

> curl_multi_socket_action calls the callback to remove the socket

Breakpoint 1, timer_callback (multi=0x8059778, timeout_ms=8,
timer_data=0x8059778) at load.c:183
183 fprintf(stderr, "%s:%i Updating timeout (%lu,
%lu)\n", __FILE__, __LINE__, (ulong) tv.tv_sec, (ulong) tv.tv_usec);
(gdb) bt
#0 timer_callback (multi=0x8059778, timeout_ms=8, timer_data=0x8059778)
at load.c:183
#1 0xb7ef3396 in update_timer (multi=0x8059778) at multi.c:1912
#2 0xb7ef4808 in curl_multi_socket_action (multi_handle=0x8059778, s=8,
ev_bitmask=1, running_handles=0x804aa94) at multi.c:1840
#3 0x08048f6b in event_callback (socket=8, action=2,
event_data=0x8059778) at load.c:97
#4 0xb7f0a790 in event_base_loop () from /usr/lib/libevent-1.3b.so.1
#5 0xb7f0a989 in event_loop () from /usr/lib/libevent-1.3b.so.1
#6 0xb7f0a9ae in event_dispatch () from /usr/lib/libevent-1.3b.so.1
#7 0x080493f1 in load () at load.c:203
#8 0x080494c2 in main () at load.c:216
(gdb) c
Continuing.

load.c:183 Updating timeout (10, 8000)

> and updates the multi timeout

load.c:109 rc is -1

> BUT returns CURLM_CALL_MULTI_PERFORM

load.c:94 looping in event_callback

> calling curl_multi_socket_action _again_ as requested returns error.

load.c:109 rc is 5
E: load.c:113 Invalid socket argument (8)

Seems like a race condition with the timer_callback, as it only happens
when the timer callback kicks in (thats why I got the breakpoint there,
and changed the actually used timeout value).

Changed code is attached.

MfG
Markus

  • text/x-csrc attachment: load.c
Received on 2008-04-29