Page MenuHomeIn-Portal Phabricator

INP-1753 - Protect against racing condition during Scheduled Tasks execution

Authored by alex on Mar 25 2019, 11:38 AM.


Test Plan


  • in IDE:
    1. go to Languages & FrameworksPHPDebug section of PhpStorm settings dialog
    2. set Max simultaneous connections setting to 3
    3. save changes
  • in Admin Console:
    1. go to ConfigurationWebsiteAdvanced section
    2. enable Use Cron to run Scheduled Tasks setting
    3. save changes
    4. go to ConfigurationWebsiteScheduled Tasks section
    5. disable all scheduled tasks
    6. pick several tasks, that are executed each minute (update Run Schedule of any other task to make it usable in the test)
    7. enable picked tasks (Cancel them if they're marked as running currently)
  • in IDE:
    1. replace body of above chosen scheduled tasks with `echo #' . getmypid() . ' - ' . $event . PHP_EOL;
    2. place breakpoint on foreach ($events_source as $short_name => $event_data) { line in \kScheduledTaskManager::runAll method
  • in Terminal (start 2 windows in parallel):
    1. enable debugging from CLI
    2. run php tools/cron.php in folder of the project

Test Plan

Goal is to test, that even if both tools/cron.php started with same available scheduled task list they won't execute scheduled tasks, that were processed from parallel process.

Diff Detail

rINP In-Portal
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

alex created this revision.Mar 25 2019, 11:38 AM
alex requested review of this revision.Mar 25 2019, 11:38 AM
erik accepted this revision.Mar 27 2019, 5:55 AM
This revision is now accepted and ready to land.Mar 27 2019, 5:55 AM
alex added a project: Restricted Project.Mar 27 2019, 2:58 PM
This revision was landed with ongoing or failed builds.Jan 11 2021, 2:57 AM
This revision was automatically updated to reflect the committed changes.