Fix race condition in GridNioServer
@@ -2849,22 +2849,14 @@ public class GridNioServer<T> {
IOException err = new IOException("Failed to send message (connection was closed): " + ses);
- if (outRecovery != null || inRecovery != null) {
try {
+ if (outRecovery != null || inRecovery != null) {
// Poll will update recovery data.
while ((req = ses.pollFuture()) != null) {
if (req.skipRecovery())
req.onError(err);
}
}
- finally {
- if (outRecovery != null)
- outRecovery.release();
-
- if (inRecovery != null && inRecovery != outRecovery)
- inRecovery.release();
- }
- }
else {
if (req != null)
req.onError(err);
@@ -2879,6 +2871,14 @@ public class GridNioServer<T> {
catch (IgniteCheckedException e1) {
filterChain.onExceptionCaught(ses, e1);
}
+ }
+ finally {
+ if (outRecovery != null)
+ outRecovery.release();
+
+ if (inRecovery != null && inRecovery != outRecovery)
+ inRecovery.release();
+ }
return true;
}
