Bug #67463
closed
Scheduler sometimes uses 100% CPU for days
Added by Lienhart Woitok over 9 years ago.
Updated about 7 years ago.
Description
On several servers I regularly notice PHP-CLI processes taking 100% CPU and accumulating several thousand CPU minutes. Today I debugged further and attached gdb to one of these processes and noticed it calling Scheduler->fetchTask in a loop. It was quite hard to really follow the execution flow of php, but as far as I figured it out it does the database query to look for a new task to execute, handles an exception and starts over. A possible path how this can lead to an endless loop is a mysql timeout (mysql has gone away), which results in a FALSE result from exec_SELECTquery, throwing an UnexpectedValueException, which is then handled in scheduler_cli_dispatch.php:68 with a continue call, starting the loop again.
It could easily be fixed by throwing an OutOfBoundsException (which stops the loop) instead of the UnexpectedValueException in case of an SQL error preventing the task fetching. Is there a specific reason why the execution should continue in this case? The exception was introduced by Mathias Schreiber, maybe he can say something about that?
I noticed scheduler tasks running amok too. Thanks for investigating!
- Status changed from New to In Progress
- Assignee set to Mathias Schreiber
- Target version set to 7.4 (Backend)
- Sprint Focus set to On Location Sprint
I will change it to an out of bounds exception.
The original request was to have an exception in case the DB tables were corrupt.
- Status changed from In Progress to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40256
Hey lienhart,
can you check the proposed patch in production?
If this solves your problem, don't hesitate to +1 it on gerrit.
Thanks for the good catch.
Thanks for taking care. We now have two Changes in gerrit for this, but I can abandon mine: https://review.typo3.org/#/c/40248/. Don't know why my change was not linked to this issue.
Are you on Slack?
In case you're not:
Your commit message only featured "Related".
In order to "really really" connect Gerrit and Forge, you would've needed to set "Resolves:"
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40263
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Sprint Focus deleted (
On Location Sprint)
- Status changed from Resolved to Closed
Also available in: Atom
PDF