> 
> 
> OK, I have checked the remote when the Content-Length field is set, 
> and that works. So it seems to be necessary. Grrr.. rewrite of webserver
> coming up ;(


Ok, it is done and checked in, and now everything works fine on localhost,
however with the remote server, the old problem is back: the tail of
some data simply isn't being delivered. Firefox hangs waiting for
data after having shown some of it. It keeps waiting even after the server
shuts down the connection and closes the socket. There is a 10 second
delay in the server before the shutdown.. ok, this is on slicehost.com
so maybe that isn't long enough ..

I'm again at a loss ;(

There seem like two possibilities:

1) There's a bug in the transmission code (demux, faio).

2) The known bug in Posix sockets is the problem.

The bug is that you cannot reliably close a socket in async mode,
because when you do close it the OS can flush out all its
buffers immediately .. and there's no way to tell if there's
any data left to transmit. My solution is the time delay.. which
is what I'd expect the OS *should* do: try to send for a certain time.

It isn't clear to me if shutdown() sends a reset immediately or buffers
it at the end of a transmission .. ditto for reading.

Linux does in fact flush out all its buffers and close immediately
on a close() call.

I've had a good look at curl, but I can't figure out how exactly what it
is doing. It IS using async I/O, but inside the one pthread.

The write operation I'm doing is the WHOLE response in a single go,
so demux/faio should block the calling fthread until the whole
transfer is complete.

If I hit RELOAD on firefox it sometimes works and sometimes not,
the behaviour is symptomatic of some kind of intermittent fault.

Just to be clear: the writes are done using async I/O in the demux
pthread when the event notifier (epoll on Linux) says there
is space to write. Judging by numbers on my mac the buffers are
quite large. certainly larger than the single page that I'm getting
the fault on after only about 6 lines display (however, firefox
definitely buffers input and doesn't display it all whilst waiting
so it may have read more than is displayed).

Curl says:

curl: (56) Failure when receiving data from the peer

.. sometimes .. other times it just hangs :)

--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to