curl-library
libcurl + libuv problem on Windows 7 x64
Date: Sat, 10 May 2014 16:58:18 +0000
First, I'm still learning C++, and to do so, I'm creating a libcurl binding for nodejs.
The code is on github: https://github.com/JCMais/node-libcurl
This is mostly about the code in the multi handler socket callback: https://github.com/JCMais/node-libcurl/blob/develop/src/Curl.cc#L267
When a connection timeout, and libcurl tries to make another request to the next ip, libuv gives a error saying that the handle is being closed, see:
>node examples\simple-request.js www.google.com:81
* Rebuilt URL to: www.google.com:81/
* Hostname was NOT found in DNS cache
* Trying 200.149.119.118...
Action: 2
Socket: 00000000
* After 2390ms connect time, move on!
* connect to 200.149.119.118 port 81 failed: Timed out
* Trying 200.149.119.89...
Action: 4
Socket: 006A0898
Action: 2
Socket: 00000000
Assertion failed: ((handle)->flags & UV__HANDLE_CLOSING) == 0, file src\win\poll.c, line 190
-----------------------------------------------------------
This error only occurs on Windows, interesting enough, on Linux, the order in which the socket callback is called is inverted, that is, first it receives a CURL_POLL_OUT before the CURL_POLL_REMOVE.
$ node examples/simple-request.js www.google.com:81
* About to connect() to www.google.com port 81 (#0)
* Trying 200.149.119.123...
* 0x2d41980 is at send pipe head!
* STATE: CONNECT => WAITCONNECT handle 0x2cebdf0; (connection #0)
Action: 2
Socket: 0
* After 2407ms connect time, move on!
* Trying 200.149.119.98...
Action: 2
Socket: 0
Action: 4
Socket: 0x2d4d260
* After 1203ms connect time, move on!
* Trying 200.149.119.94...
Action: 2
Socket: 0
Action: 4
Socket: 0x2d4d370
* After 600ms connect time, move on!
* Trying 200.149.119.114...
Action: 2
Socket: 0
Action: 4
Socket: 0x2d4d260
* Connection timed out after 5040 milliseconds
* STATE: WAITCONNECT => COMPLETED handle 0x2cebdf0; (connection #-5000)
* STATE: COMPLETED => MSGSENT handle 0x2cebdf0; (connection #-5000)
Action: 4
Socket: 0x2d4cab0
* Closing connection #0
Err: [Error: Timeout was reached]
Code: 28
-----------------------------------------------------------
I'm using this "gypified" version of libcurl: https://github.com/peters/curl-for-windows
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-05-10