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

bug: OOM errors on stream handler as of Monolog 2.3.0 #1577

Closed
bshaffer opened this issue Jul 29, 2021 · 3 comments
Closed

bug: OOM errors on stream handler as of Monolog 2.3.0 #1577

bshaffer opened this issue Jul 29, 2021 · 3 comments
Labels
Milestone

Comments

@bshaffer
Copy link

Monolog version 2 (only on 2.3.0+)

Error: PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 2147483647 bytes) in...

This can be recreated with the following file (note the php ini setting memory_limit=2048M):

ini_set('memory_limit', '2048M');

$stream = tmpfile();
new Monolog\Handler\StreamHandler($stream);
stream_get_contents($stream);

@dwsupplee tracked the issue down to this change. When I remove the calls to stream_set_chunk_size in the handler, the OOM error disappears.

I don't know the proper solution, if this change should just be reverted, or if we should do something to ensure the memory limit is less than the chunk size... maybe there's some specific handling necessary for tmpfile? Either way, this is a pretty nasty error so any help is appreciated!

@bshaffer bshaffer added the Bug label Jul 29, 2021
@juan-morales
Copy link
Contributor

I Will create a PR during The morning... to propose a solution for this

@juan-morales
Copy link
Contributor

The pull request is created but it cannot pass a phpstan test, and I dont know if is my change or something else.

Any help?

MohammedAttya2 added a commit to MohammedAttya2/framework that referenced this issue Aug 17, 2021
Monolog 2.3.0+ produces `PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 2147483647 bytes)`
Seldaek/monolog#1577
@Seldaek Seldaek added this to the 2.x milestone Sep 14, 2021
@Seldaek
Copy link
Owner

Seldaek commented Sep 14, 2021

Should be fixed by #1578

@Seldaek Seldaek closed this as completed Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants