[Mono-devel-list] Trouble with HttpWebResponse

Dick Porter dick at ximian.com
Tue Mar 4 06:05:38 EST 2003

On Tue, 2003-03-04 at 10:41, Paolo Molaro wrote:
> I straced it and found that it gets the data from the server in about 3
> seconds (just like lynx -dump) and then gooes into a loop:
> and gets back to the nanosleep.
> Calls to nanosleep with a NULL second argument are in:
> io-layer/handles.c:			nanosleep (&sleepytime, NULL);

This one can happen if someone is in the middle of a
WaitForMultipleObjects() and is trying to get an exclusive lock on
multiple handles but is suffering from contention.

> io-layer/mono-mutex.c:		nanosleep (&sleepytime, NULL);

This one is from a compatibility function for pthread libraries that
don't have pthread_mutex_timedlock().  Solaris and glibc <= 2.1.

> io-layer/shared.c:		nanosleep (&sleepytime, NULL);

This one happens when the daemon has been started and we're waiting for
it to signal "ready".

It's possible that something inside glibc() is calling nanosleep(). 
Otherwise if the call is from mono code then the first is the only real
possibility, unless you're running an ancient dist.  I can't think of
anything offhand in the socket code that might be doing this though. 
(Theres the thread cleanup WaitForMultipleObjects(), but a 16 second
delay waiting for a thread to exit sounds odd to me.)

I wonder if the http server is holding the socket open to handle a
http/1.1 streaming connection?  Telnetting to apache on localhost and
issuing a request looks plausible:

:; time telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
host: localhost

HTTP/1.1 200 OK

[leave it sitting there...]

Connection closed by foreign host.
telnet localhost 80  0.01s user 0.00s system 0% cpu 17.456 total

- Dick

More information about the Mono-devel-list mailing list