Page MenuHomePhabricator

D21369.id50858.diff
No OneTemporary

D21369.id50858.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
Tue, Oct 15, 10:23 PM (2 d, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714687
Default Alt Text
D21369.id50858.diff (909 B)

Event Timeline