[erlang-questions] file:open's delayed_write behavior does not correspond to docs.
Tue Feb 20 10:05:28 CET 2007
I can confirm your reported behaviour, on Solaris 8 using
truss to see the system calls.
It seems to be a bug that nobody noticed. It appears that after
the set time the delayed write is transferred to the file drivers
todo queue, but the queue is not checked until next event,
which is the next write.
On Mon, Feb 19, 2007 at 10:35:43PM -0800, wrote:
> I have opened a port using
> file:open("/path/to/file", [append, raw, delayed_write])
> and the process holding open the port receives messages, converts them
> to IOdata, and sends them to the port using file:write/2. According
> to the Erlang documentation, the port should write its data when
> * 64kB of output data have accumulated, or
> * when the oldest datum in the buffer reaches 2 seconds old
> This is thanks to the default 'delayed_write' parameters.
> My program's output turns out to be consistenly one message behind the
> messages being sent. The first message "disappears" until I send the
> second message, at which point it appears in the file. When I send
> the third message, the second one appears in the file, etc. The last
> message only appears when closing the file. The 2 second limit
> doesn't seem to have any effect.
> Has anyone encountered this behavior before? It's R11B-2 running on
> Derek Upham
> erlang-questions mailing list
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions