Skip to content

Commit cccf48e

Browse files
aivanovxjenkins
authored andcommitted
[loadbalancer] add timeout to ApertureEagerConnections
# Problem ApertureEagerConnections object has a semaphore which is shared by all services. If a service is misconfigured and blocks the semaphore - all other services suffer. Plus this can lead to OutOfMemory, because the semaphore queue is unbounded. # Solution Add a conservative timeout. JIRA Issues: MEDIASERV-18729 Differential Revision: https://phabricator.twitter.biz/D1249464
1 parent cfb1844 commit cccf48e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

finagle-core/src/main/scala/com/twitter/finagle/loadbalancer/aperture/ApertureEagerConnections.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ package com.twitter.finagle.loadbalancer.aperture
22

33
import com.twitter.concurrent.AsyncSemaphore
44
import com.twitter.finagle.stats.FinagleStatsReceiver
5-
import com.twitter.util.{Future, Time}
5+
import com.twitter.finagle.util.DefaultTimer
6+
import com.twitter.util.Duration
7+
import com.twitter.util.Future
8+
import com.twitter.util.Time
69

710
private[aperture] object ApertureEagerConnections {
811
// exposed for testing
@@ -24,6 +27,9 @@ private[aperture] object ApertureEagerConnections {
2427
latencyStat.add(dur)
2528

2629
task
30+
// A conservative timeout to prevent a misconfigured service
31+
// from blocking all other services
32+
.raiseWithin(Duration.fromSeconds(60))(DefaultTimer)
2733
}
2834
}
2935
}

0 commit comments

Comments
 (0)