Commit 7d7d3fd0 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-894: Do not attempt to close a session that is already closing.

parent 6716afbf
...@@ -47,17 +47,19 @@ public class StalledSessionsFilter extends IoFilterAdapter { ...@@ -47,17 +47,19 @@ public class StalledSessionsFilter extends IoFilterAdapter {
@Override @Override
public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest)
throws Exception { throws Exception {
// Get number of pending requests if (!session.isClosing()) {
long pendingBytes = session.getScheduledWriteBytes(); // Get number of pending requests
if (pendingBytes > bytesCap) { long pendingBytes = session.getScheduledWriteBytes();
// Get last time we were able to send something to the connected client if (pendingBytes > bytesCap) {
long writeTime = session.getLastWriteTime(); // Get last time we were able to send something to the connected client
int pendingRequests = session.getScheduledWriteMessages(); long writeTime = session.getLastWriteTime();
Log.debug("About to kill session with pendingBytes: " + pendingBytes + " pendingWrites: " + int pendingRequests = session.getScheduledWriteMessages();
pendingRequests + " lastWrite: " + new Date(writeTime) + "session: " + session); Log.debug("About to kill session with pendingBytes: " + pendingBytes + " pendingWrites: " +
// Close the session and throw an exception pendingRequests + " lastWrite: " + new Date(writeTime) + "session: " + session);
session.close(false); // Close the session and throw an exception
throw new IOException("Closing session that seems to be stalled. Preventing OOM"); session.close(false);
throw new IOException("Closing session that seems to be stalled. Preventing OOM");
}
} }
// Call next filter (everything is fine) // Call next filter (everything is fine)
super.filterWrite(nextFilter, session, writeRequest); super.filterWrite(nextFilter, session, writeRequest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment