Page MenuHomePhabricator

D21369.id50860.diff
No OneTemporary

D21369.id50860.diff

diff --git a/src/infrastructure/util/PhabricatorGlobalLock.php b/src/infrastructure/util/PhabricatorGlobalLock.php
--- a/src/infrastructure/util/PhabricatorGlobalLock.php
+++ b/src/infrastructure/util/PhabricatorGlobalLock.php
@@ -144,6 +144,18 @@
$ok = head($result);
if (!$ok) {
+
+ // See PHI1794. We failed to acquire the lock, but the connection itself
+ // is still good. We're done with it, so add it to the pool, just as we
+ // would if we were releasing the lock.
+
+ // If we don't do this, we may establish a huge number of connections
+ // very rapidly if many workers try to acquire a lock at once. For
+ // example, this can happen if there are a large number of webhook tasks
+ // in the queue.
+
+ self::$pool[] = $conn;
+
throw id(new PhutilLockException($lock_name))
->setHint($this->newHint($lock_name, $wait));
}

File Metadata

Mime Type
text/plain
Expires
May 16 2024, 6:02 PM (8 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284134
Default Alt Text
D21369.id50860.diff (909 B)

Event Timeline