Homec4science

Fix a possible deadlock in unit tests after an error

Authored by epriestley <git@epriestley.com> on Dec 24 2015, 15:37.

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

Committed
epriestley <git@epriestley.com>Dec 24 2015, 18:11
Pushed
aubortJan 31 2017, 17:16
Parents
rPH19b2eb57a94d: Improve lipsum generation of projects
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH37f1f555577c: Fix a possible deadlock in unit tests after an error (authored by epriestley <git@epriestley.com>).Dec 24 2015, 18:11