-
Notifications
You must be signed in to change notification settings - Fork 601
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
Keepalive thread's interrupt signal may be catched when it is sleeping #283
Comments
Yes, you're right. Please send a PR
2016-11-29 15:09 GMT+01:00 gatesking <notifications@github.com>:
… In Keepalive.java:
try {
while (!isInterrupted()) {
final int hi = getPositiveInterval();
if (conn.getTransport().isRunning()) {
log.debug("Sending keep-alive since {} seconds elapsed", hi);
doKeepAlive();
}
**Thread.sleep(hi * 1000);**
}
} catch (Exception e) {
// If we weren't interrupted, kill the transport, then this exception was unexpected.
// Else we're in shutdown-mode already, so don't forcibly kill the transport.
if (!isInterrupted()) {
conn.getTransport().die(e);
}
}
when keepalive interrupt is called in ConnectionImpl.notifyError, the
interrupt signal may be catched by Thread.sleep, as a result, it will still
go into conn.getTransport().die(e).
I suggest this will be better, am I right?
try {
while (!isInterrupted()) {
final int hi = getPositiveInterval();
if (conn.getTransport().isRunning()) {
log.debug("Sending keep-alive since {} seconds elapsed", hi);
doKeepAlive();
}
Thread.sleep(hi * 1000);
}
} **catch (InterruptedException e) {
// do nothing
}** catch (Exception e) {
// If we weren't interrupted, kill the transport, then this exception was unexpected.
// Else we're in shutdown-mode already, so don't forcibly kill the transport.
if (!isInterrupted()) {
conn.getTransport().die(e);
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#283>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHLo4j8Yg2WPk6kLKq0NvfCcMzj8EsVks5rDDIlgaJpZM4K_Ayo>
.
|
Merged #284, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Keepalive.java:
when keepalive interrupt is called in ConnectionImpl.notifyError, the interrupt signal may be catched by Thread.sleep, as a result, it will still go into conn.getTransport().die(e).
I suggest catch interrupt signal will be better, am I right?
Thanks!
The text was updated successfully, but these errors were encountered: