Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14851886
D21369.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
909 B
Referenced Files
None
Subscribers
None
D21369.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 5, 9:11 PM (14 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7092837
Default Alt Text
D21369.diff (909 B)
Attached To
Mode
D21369: When acquiring a GlobalLock, put good connections that just got unlucky back in the pool
Attached
Detach File
Event Timeline
Log In to Comment