NTCP: Catch race in Reader (ticket #1534)

This commit is contained in:
zzz
2015-05-13 10:52:26 +00:00
parent a3b1327934
commit 0e17c560b3

View File

@@ -98,8 +98,10 @@ class Reader {
if (keepReading) { if (keepReading) {
// keep on reading the same one // keep on reading the same one
} else { } else {
_liveReads.remove(con); if (con != null) {
con = null; _liveReads.remove(con);
con = null;
}
if (_pendingConnections.isEmpty()) { if (_pendingConnections.isEmpty()) {
_pendingConnections.wait(); _pendingConnections.wait();
} else { } else {
@@ -116,6 +118,10 @@ class Reader {
_log.debug("begin read for " + con); _log.debug("begin read for " + con);
try { try {
processRead(con); processRead(con);
} catch (IllegalStateException ise) {
// FailedEstablishState.receive() (race - see below)
if (_log.shouldWarn())
_log.warn("Error in the ntcp reader", ise);
} catch (RuntimeException re) { } catch (RuntimeException re) {
_log.log(Log.CRIT, "Error in the ntcp reader", re); _log.log(Log.CRIT, "Error in the ntcp reader", re);
} }
@@ -153,6 +159,7 @@ class Reader {
EventPumper.releaseBuf(buf); EventPumper.releaseBuf(buf);
break; break;
} }
// FIXME call est.isCorrupt() before also? throws ISE here... see above
est.receive(buf); est.receive(buf);
EventPumper.releaseBuf(buf); EventPumper.releaseBuf(buf);
if (est.isCorrupt()) { if (est.isCorrupt()) {