Skip to content

Commit

Permalink
Prevent web queries from running for more than 30 seconds
Browse files Browse the repository at this point in the history
Summary:
Ref T10849. This enforces a global 30-second per-query time limit for anything not coming from the CLI.

If we run into another issue with MySQL hanging in the future, this should prevent it from being nearly as bad as it was.

Test Plan:
  - Set value to 0, verified the UI threw an exception immediately.
  - Set value back to 30, browsed around a bunch of pages.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10849

Differential Revision: https://secure.phabricator.com/D15799
  • Loading branch information
epriestley committed Apr 26, 2016
1 parent 2c870ba commit 0630fef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
Expand Up @@ -75,6 +75,12 @@ protected function establishLiveConnection($mode) {
$connection->setReadOnly(true);
}

// Unless this is a script running from the CLI, prevent any query from
// running for more than 30 seconds. See T10849 for discussion.
if (php_sapi_name() != 'cli') {
$connection->setQueryTimeout(30);
}

return $connection;
}

Expand Down

0 comments on commit 0630fef

Please sign in to comment.