php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40897 error_log file not locked
Submitted: 2007-03-22 20:39 UTC Modified: 2007-04-05 14:27 UTC
From: david at acz dot org Assigned: iliaa (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.2.1 OS: Any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: david at acz dot org
New email:
PHP Version: OS:

 

 [2007-03-22 20:39 UTC] david at acz dot org
Description:
------------
The internal php_log_err function does not lock the output file.  This causes long messages to get mixed together.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-25 14:22 UTC] iliaa@php.net
Append is atomic and does not require locking.
 [2007-03-26 14:17 UTC] david at acz dot org
O_APPEND is atomic for a single write.  php_log_err uses stdio, so a log entry longer than the stdio buffer size will cause non-atomic writes.

Try this:

for x in A B; do php -r 'ini_set("error_log","/tmp/test.log");for($i=0;$i<10000;$i++)error_log(str_repeat("'$x'",5000));' & done
 [2007-04-01 19:29 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2007-04-05 14:27 UTC] rquadling@php.net
A Win32 equivalent...

for %x in (1 2) do start php -r "ini_set('error_log','/tmp/test.log');for($i=0;$i<10000;$i++)error_log(str_repeat(%x,5000));"

This should all be on 1 line.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC