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

Close file handle after each write #1883

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Close file handle after each write #1883

wants to merge 1 commit into from

Conversation

Seldaek
Copy link
Owner

@Seldaek Seldaek commented Apr 15, 2024

refs #1862, refs #1860, refs #1634

@rossmckelvie
Copy link

Thank you for making this fix, happy to share it's working for us. We deployed this fix to production today and its resolved hangups we were seeing on fwrite() leading to requests taking 10+ seconds.

@Seldaek Seldaek changed the title Close file handle after each write, refs #1862, refs #1860, refs #1634 Close file handle after each write Jul 8, 2024
@eerison
Copy link

eerison commented Sep 6, 2024

Hello @Seldaek

as it was found on version 2.x, couldn't it be released on version 2.x? this way we could still have this issue solved on php 8.0 and 8.2, and make a smooth php upgrade :)

Edit: I just saw there is a PR for 2.x :)

@Seldaek
Copy link
Owner Author

Seldaek commented Sep 6, 2024

There is #1882 for 2.x, but the problem is nobody has confirmed this fixes anything for them so far, so I'd rather not merge this for nothing as it does introduce overhead for everyone.

@ChipZ91
Copy link

ChipZ91 commented Sep 6, 2024

Unfortunately we have the same error despite the change.

@ivanmartinvalle
Copy link

For reference this is how we applied the workaround directly without needing upstream changes. The project in question is on monolog 1.

class ClosingStreamHandler extends StreamHandler
{
    protected function streamWrite($stream, array $record)
    {
        parent::streamWrite($stream, $record);

        // https://github.com/Seldaek/monolog/pull/1883
        parent::close();
    }
}

@ChipZ91
Copy link

ChipZ91 commented Sep 6, 2024

I have to correct myself. Unfortunately, we have the error twice in our system. Once through monolog and once via symfony/process.

I can confirm that the fix here fixes the monolog case.

Thank you for the work and @ivanmartinvalle for the information that helped me understand our case.

Copy link

@ChipZ91 ChipZ91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is working for us.

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

Successfully merging this pull request may close these issues.

5 participants