httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 20295] - apr_file_write_full() to pipe with timeout can return EAGAIN
Date Wed, 04 Jun 2003 17:49:57 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20295>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20295

apr_file_write_full() to pipe with timeout can return EAGAIN





------- Additional Comments From trawick@apache.org  2003-06-04 17:49 -------
oops, moron alert :)   Somebody pointed this out back in October of 2002 and I
responded...  my suggestion then was to drop the atomic support by default
(i.e., if poll(POLLOUT) says "ready", write as much as we can rather than
waiting until we can write the entire buffer)

none of the other APR developers suggested an alternative, but the discussion
dropped and unfortunately my memory isn't so good

Let's consider the discussion re-opened, and a reasonable solution now
implemented in

http://www.apache.org/~trawick/PR20295/pipes_are_not_atomic.patch

With this solution, writes on APR pipes are not necessarily atomic.  (I doubt
that we really promised that before).

Here is a truss from AIX showing the behavior with this patch:

kwrite(4, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8000)   Err#11 EAGAIN

darn, we can't write our 8000-byte message, so wait until it will work

_poll(0x2FF22678, 0x00000001, 0x00001F40, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF) = 0x00000001

cool, we can write now?

kwrite(4, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8000)   Err#11 EAGAIN

darn, you won't gulp all 8000 bytes... try again with half-that

kwrite(4, "\0\0\0\0\0\0\0\0\0\0\0\0".., 4000)   Err#11 EAGAIN

ouch, try again

kwrite(4, "\0\0\0\0\0\0\0\0\0\0\0\0".., 2000)   Err#11 EAGAIN

ouch, try again

kwrite(4, "\0\0\0\0\0\0\0\0\0\0\0\0".., 1000)   Err#11 EAGAIN

ouch, try again

kwrite(4, "\0\0\0\0\0\0\0\0\0\0\0\0".., 500)    = 500

finally we made some progress so apr_file_write() can return

Perhaps nbytes should be divided by 4 every time instead of halved.  Or, perhaps
after poll() reports "ready" but the first write() fails we should drop down to
25% of PIPE_BUF.  Shrug.  On my AIX box where I tested the change, this testcase
gets into the retry logic pretty infrequently, so the current halving technique
doesn't seem too expensive.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message