-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
The file does not close after writing #1862
Comments
@Seldaek I think this may be a good path forward regarding the broken pipe errors people are seeing (including us, as well - as of 2 months ago). Do you foresee any issues with the stream being closed at the end of each write? |
We have this issue as well in production, seems like file descriptors aren't getting closed as the issue appears more and more as the server uptime increase. Restarting the kube pod fix the issue for a while. So yeah there must be some missing fclose somewhere. More information: PHP 8.2, Laravel 10, Monolog 3.5 Really started to notice random 500 errors caused by this on our app after upgrading to PHP 8.2 and Monolog 3 Edit: we are using php-fpm |
Monolog handlers have a concept of closing them. The StreamHandler will close the stream only when closing the handler (assuming you configured it in a way where the handler is the one opening the stream, not when passing it a stream managed externally that it could not re-open later). |
Yeah, as far as I understand it should closes on |
I think maybe what we could try here is to close the stream when |
Ok this should be fixed in the next release as long as you call reset() correctly between every job in a long running process. |
Monolog version 3
We use Laravel and queues. Queue is maintained by supervisor.
The queue writes a log. But after deleting the log, the task in the queue no longer writes to the log. All because the file does not close after writing (fclose).
Here src/Monolog/Handler/StreamHandler.php, method write, but then it doesn't close stream.
I tested, if I added a fclose($stream) at the end of the write method, the problem disappears.
The text was updated successfully, but these errors were encountered: