Skip to content


Subversion checkout URL

You can clone with
Download ZIP


write error (race condition?) #85

pkeane opened this Issue · 9 comments

3 participants


I've been getting this message regularly when hitting the app w/ batch processes (nb., /path/to/log/file.log IS valid & writeable and was successfully written to by the 800 or so operations previous to this):

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/path/to/log/file.log" could not be opened; it may be invalid or not writable.' in /var/www/daseframework/lib/Monolog/Handler/StreamHandler.php:67
Stack trace:
#0 /var/www/daseframework/lib/Monolog/Handler/AbstractProcessingHandler.php(41): Monolog\Handler\StreamHandler->write(Array)
#1 /var/www/daseframework/lib/Monolog/Logger.php(191): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /var/www/daseframework/lib/Monolog/Logger.php(294): Monolog\Logger->addRecord(100, 'INSERT INTO ite...', Array)
#3 /var/www/daseframework/lib/Dase/DBO.php(190): Monolog\Logger->debug('INSERT INTO ite...')
#4 /var/www/daseframework/lib/Dase/DBO/Item.php(162): Dase_DBO->insert()

perhaps there is a race condition??


It's probably file locking - I take it you're encountering this on linux?


YES - linux (RedHat):

uname -a
Linux [...] 2.6.32-220.7.1.el6.x86_64 #1 SMP Fri Feb 10 15:22:22 EST 2012 x86_64 x86_64 x86_64 GNU/Linux


Perhaps you should the syslog handler or hack together a handler that blind-fires to a remote logger on another system (which would be hooked up to a full DBMS) up instead - that would allow simultaneous logging.

My bet is that you're probably just hitting file locking, which isn't something that can be helped, really.

ed: SocketHandler or SyslogHandler are the best options for you IMO


Great. Thanks!


That's quite weird, I'd think opening a stream multiple times in "append" mode would be no problem. @damianb do you know if that's a platform specific issue?


if it was, it'd be observed much more often; it's just a linux system.

could be filesystem related, but my bet is that he's not on anything exotic; probably ext2/3/4.


I fixed the code now so that it doesn't hide the php error but exposes it to the user, so if you update to latest you should see different errors, and hopefully it gives us a better insight as to what is happening.


No news here?


I'll close since there is no feedback, but if it crops up again with the latest version let me know.

@Seldaek Seldaek closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.