From: Eric Anderson Date: 2004-12-11T15:32:34+09:00 Subject: fsync on stdout for mod_rewrite I have a script that I want to ensure has flushed stdout after ever line of output. I have $stdout.sync=true but when I tried to do $stdout.fsync I get an Invalid Argument error. Not what I expect according to the docs. My goal is that I have a script providing lookups for mod_rewrite in Apache. It hands me the HTTP_HOST header on $stdin and I return the path where it should look for a specific website on $stdout. It seems to work well but every now and then it returns the wrong answer. My only two possibilities that I can see for this problems are: 1) Apache is asking the script the next request before the first request is answered. But I am using the RewriteLock directive so Apache should have the requests synchronized. 2) My other option is that the buffer is not getting flushed. Then another request comes it and both answers are outputted with the first answer being the wrong answer. The script seems to perform perfect when run from the command line. Just not in Apache. Sometime is returns the right answer sometimes it returns the wrong answer. Even when make the same request (i.e. refresh). See http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html if you are curious on the mod_rewrite semantics. If posting the script would help I can post that also. I appreciate any pointers. Eric