cURL / Mailing Lists / curl-library / Single Mail

curl-library

Multi-interface: the multi-uv example doesn't work with a localhost WWW service

From: Waldek Kozba <100assc_at_gmail.com>
Date: Mon, 6 Oct 2014 15:07:17 +0200

Hi,

as in the title: the multi-uv example (
http://curl.haxx.se/libcurl/c/multi-uv.html) does not download for me the
content from the local WWW server (local means the example is being run on
the same VM that the WWW server runs).
When I change the URL to the identical WWW service (actually a clone of it)
on another VM all runs fine and I'm getting the download result in a file.
When it's a localhost service (no matter if http://localhost or
http://127.0.0.1 or hostname or any of this server IPs), the multi
interface does not call the socket callback void. It only calls the timer
callback, and in effect the easy handle is added to multi, but that's it -
no socket callback call.

What could be interesting - when I add some sleep before the loop start:

nanosleep(...)
uv_run(loop, UV_RUN_DEFAULT);

.. it starts calling the socket callback - the bigger sleep value the more
likely it'll happen. With some values (like 100 ms) it just happens
randomly.
Looks a bit like the localhost connection is kinda too fast for the events
to be processed correctly..

I've experienced that firstly on Ubuntu VM:
- Linux 3.11.0-17-generic #31-Ubuntu SMP Mon Feb 3 21:52:43 UTC 2014 x86_64
x86_64 x86_64
- libuv-dev:amd6 0.10.27-2
- curl 7.32.0 (x86_64-pc-linux-gnu) libcurl/7.32.0 OpenSSL/1.0.1e
zlib/1.2.8 libidn/1.28 librtmp/2.3

Then i've confirmed on CentOS 6.5:
- Linux 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014
x86_64 x86_64 x86_64
- libuv-devel-0.10.27-1.el6.x86_64
- curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3
zlib/1.2.3 libidn/1.18 libssh2/1.4.2

Finally I've created a brand fresh Centos 6.5 VM, updated with yum, and
compiled the curl/libcurl from GitHub master sources, same with Libuv, and
ended up with exactly same result. Environment:
- Linux 2.6.32-431.29.2.el6.x86_64 #1 SMP Tue Sep 9 21:36:05 UTC 2014
x86_64 x86_64 x86_64
- libuv.so.1.0.0
- curl 7.38.1-DEV (x86_64-unknown-linux-gnu) libcurl/7.38.1-DEV
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: Debug TrackMemory IPv6 Largefile

Just f.y.i. - In all cases I've used simple WWW static page on Apache
(2.2.15), but I don't think that server type has any impact here, at least
the same behaviour I've experienced with Varnish in place of Apache.

Could you please verify that (or maybe you are already aware of it)?

Best,

Waldek

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-06