Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write error (race condition?) #85

Closed
pkeane opened this issue May 17, 2012 · 9 comments
Closed

write error (race condition?) #85

pkeane opened this issue May 17, 2012 · 9 comments

Comments

@pkeane
Copy link

pkeane commented May 17, 2012

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??

@katanacrimson
Copy link

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

@pkeane
Copy link
Author

pkeane commented May 17, 2012

YES - linux (RedHat):

uname -a
Linux [...].utexas.edu 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

@katanacrimson
Copy link

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

@pkeane
Copy link
Author

pkeane commented May 17, 2012

Great. Thanks!

@Seldaek
Copy link
Owner

Seldaek commented May 21, 2012

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?

@katanacrimson
Copy link

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.

@Seldaek
Copy link
Owner

Seldaek commented Aug 18, 2012

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.

@Seldaek
Copy link
Owner

Seldaek commented Nov 11, 2012

No news here?

@Seldaek
Copy link
Owner

Seldaek commented Jan 7, 2013

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 as completed Jan 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants