mtdowling / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/
MIT License
4.89k stars 339 forks source link

Dirty but working solution for issue #50 #51

Closed viktoras25 closed 10 years ago

viktoras25 commented 10 years ago

I tested and it indeed leaked for me too. Experimentally I found out that continue 2 was a line to cause leak. Well, I'm not that good into a library to make a better patch, however this worked for me.

mtdowling commented 10 years ago

Thanks for looking into that issue. I don't think this is something I'll pull as it makes the implementation less clear, and I find it strange that using a goto would actually make a difference. I wonder if it's something else that was changed in the PR?

viktoras25 commented 10 years ago

No, nothing else has changed. I absolutely agree, this isn't something that should be in the code. However this does solve the issue, at least in my tests. I have no idea what is actually wrong with continue 2 and opcache. I think this will be fixed in future PHP updates.

ghost commented 10 years ago

Thanks for the time spent on that issue!

Here is another one experiencing the same issue:

http://stackoverflow.com/questions/23231675/php-5-5-memory-leak-when-using-continue-2-inside-two-foreach-loops

I'll try to find a bug report in PHP otherwise I'll report one myself.

DerManoMann commented 10 years ago

This looks like a matching bug report, incl. reference to continue 2: https://bugs.php.net/bug.php?id=65743

fruitl00p commented 9 years ago

We too came accross this same issue with a runaway process eating up to 1GB+ due to (after several hours of debugging) the "continue 2" statement. I'll mention this on php-src + bugs.php.net for further investigation as this seems to be beyond the scope of just this project.

(although i'd really like to see a new release with the 'goto-hack' landed in the source for atleast the time being)