Bug #67463
closedScheduler sometimes uses 100% CPU for days
100%
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?
Updated by Stephan Großberndt over 9 years ago
I noticed scheduler tasks running amok too. Thanks for investigating!
Updated by Mathias Schreiber over 9 years ago
- 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.
Updated by Gerrit Code Review over 9 years ago
- 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
Updated by Mathias Schreiber over 9 years ago
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.
Updated by Lienhart Woitok over 9 years ago
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.
Updated by Mathias Schreiber over 9 years ago
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:"
Updated by Gerrit Code Review over 9 years ago
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
Updated by Mathias Schreiber over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset d975ed579a4ce510cfbea86cc8cf1b60c9017071.
Updated by Mathias Schreiber over 9 years ago
- Sprint Focus deleted (
On Location Sprint)
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed