Project

General

Profile

Actions

Bug #67463

closed

Scheduler sometimes uses 100% CPU for days

Added by Lienhart Woitok almost 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Category:
scheduler
Target version:
Start date:
2015-06-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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?


Related issues 1 (0 open1 closed)

Follows TYPO3 Core - Bug #39085: fetchTask: Missing validation of SQL resultClosed2012-07-19

Actions
Actions #1

Updated by Stephan Großberndt almost 9 years ago

I noticed scheduler tasks running amok too. Thanks for investigating!

Actions #2

Updated by Mathias Schreiber almost 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.

Actions #3

Updated by Gerrit Code Review almost 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

Actions #4

Updated by Mathias Schreiber almost 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.

Actions #5

Updated by Lienhart Woitok almost 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.

Actions #6

Updated by Mathias Schreiber almost 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:"

Actions #7

Updated by Gerrit Code Review almost 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

Actions #8

Updated by Mathias Schreiber almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Mathias Schreiber almost 9 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions #10

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF