-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect transport executors with no remaining threads #11503
Changes from 2 commits
5ae7079
1a56f71
a6201c5
55f567c
de44623
10fbc53
2fd24b6
4d44e3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -499,6 +499,29 @@ public Runnable start(Listener listener) { | |
outboundFlow = new OutboundFlowController(this, frameWriter); | ||
} | ||
final CountDownLatch latch = new CountDownLatch(1); | ||
// This runs con-concurrently with handshake and works as a hack checking enough threads are | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't check enough threads are available to start the transport. Maybe something closer to:
|
||
// available to start the transport. | ||
executor.execute(new Runnable() { | ||
@Override | ||
public void run() { | ||
long waitStartTime = System.nanoTime(); | ||
synchronized (lock) { | ||
try { | ||
lock.wait(100); | ||
ejona86 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
} | ||
long waitEndTime = System.nanoTime(); | ||
System.out.println(waitEndTime - waitStartTime); | ||
shivaspeaks marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (waitEndTime - waitStartTime >= 100000000) { // never got notified | ||
startGoAway(0, ErrorCode.INTERNAL_ERROR, Status.UNAVAILABLE | ||
ejona86 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.withDescription("Timed out waiting for second handshake thread. " | ||
+ "The transport executor pool may have run out of threads")); | ||
} | ||
} | ||
}); | ||
|
||
// Connecting in the serializingExecutor, so that some stream operations like synStream | ||
// will be executed after connected. | ||
serializingExecutor.execute(new Runnable() { | ||
|
@@ -581,6 +604,7 @@ sslSocketFactory, hostnameVerifier, sock, getOverridenHost(), getOverridenPort() | |
if (sslSession != null) { | ||
securityInfo = new InternalChannelz.Security(new InternalChannelz.Tls(sslSession)); | ||
} | ||
lock.notify(); | ||
ejona86 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/con-concurrently/concurrently/