HomePhabricator

Fix a possible deadlock in unit tests after an error

Description

Fix a possible deadlock in unit tests after an error

Summary:
After certain types of errors, we may deadlock when trying to destroy test databases.

Specifically, we still have connections open to, say, phabricator_unittest_abasonaknlbaklnasb_herald (or whatever) and MySQL sometimes (not sure exactly when?) waits for them before destorying the database.

Test Plan:

  • Added $m = null; $m->method() to a fixture test to force a fatal.
  • Saw consistent deadlock, with storage destroy never exiting.
  • Added --trace to the storage destroy command and made it use phutil_passthru() so I could see what was happening.
  • Saw it hang on some arbitrary database.
  • Conneced to MySQL, used show full processlist; to see what was wrong.
  • Saw the DROP DATABASE ... command waiting for locks to release on the database, and other connections still open.
  • Applied patch.
  • Saw consistent success.
  • Used storage destroy --unittest-fixtures to clean up extra databases.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D14875

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Dec 24 2015, 5:11 PM
Reviewer
chad
Differential Revision
D14875: Fix a possible deadlock in unit tests after an error
Parents
rP19b2eb57a94d: Improve lipsum generation of projects
Branches
Unknown
Tags
Unknown
Build Status
Buildable 9778
Build 11752: Run Core Tests