-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
In what version(s) of Spring Integration are you seeing this issue?
6.4.9
Describe the bug
Closed a connection when occurred the RejectedExecutionException on TcpNioConnection#checkForAssembler.
Because It catch at readPacket method as follow:
public void readPacket() {
if (logger.isDebugEnabled()) {
logger.debug(getConnectionId() + " Reading...");
}
try {
doRead();
}
catch (@SuppressWarnings(UNUSED) ClosedChannelException cce) {
if (logger.isDebugEnabled()) {
logger.debug(getConnectionId() + " Channel is closed");
}
closeConnection(true);
}
catch (Exception e) {
logger.error("Exception on Read " + getConnectionId() + " " + e.getMessage(), e);
closeConnection(true); // ★★★★★ close connection this code
}
}On the other hand, AbstractConnectionFactory is implemented assuming that a RejectedExecutionException will be thrown from readPacket method.
boolean delayed = false;
try {
connection.readPacket();
}
catch (@SuppressWarnings(UNUSED) RejectedExecutionException e1) { // ★★★★ Current implementation is dead code
delayRead(selector, now, key);
delayed = true;
}Expected behavior
Instead of closing the connection, it will be delayed Read.
How about modifying it as follows?
public void readPacket() {
if (logger.isDebugEnabled()) {
logger.debug(getConnectionId() + " Reading...");
}
try {
doRead();
}
catch (@SuppressWarnings(UNUSED) ClosedChannelException cce) {
if (logger.isDebugEnabled()) {
logger.debug(getConnectionId() + " Channel is closed");
}
closeConnection(true);
}
+ catch (RejectedExecutionException ree) {
+ throw ree;
+ }
catch (Exception e) {
logger.error("Exception on Read " + getConnectionId() + " " + e.getMessage(), e);
closeConnection(true);
}
}The behavior seems to have changed in the following commit:
19b9944#diff-6451fd5c22e08caea6f3005257a2c56b99adfac27424810b8375d8848a73b61b