Skip to content

Commit

Permalink
[UNDERTOW-2002] Fixing StackOverflowError upon AJP read timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ropalka committed Dec 6, 2021
1 parent 6ac611d commit d5ed8b8
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,12 @@ private void handleBadRequest() {
}

private void handleCPing() {
sendMessages(CPONG);
if (sendMessages(CPONG)) {
AjpReadListener.this.handleEvent(connection.getChannel().getSourceChannel());
}
}

private void sendMessages(final byte[]... rawMessages) {
private boolean sendMessages(final byte[]... rawMessages) {
state = new AjpRequestParseState();
final StreamConnection underlyingChannel = connection.getChannel();
underlyingChannel.getSourceChannel().suspendReads();
Expand Down Expand Up @@ -310,13 +312,14 @@ public void handleEvent(ConduitStreamSinkChannel channel) {
}
});
underlyingChannel.getSinkChannel().resumeWrites();
return;
return false;
}
} while (buffer.hasRemaining());
AjpReadListener.this.handleEvent(underlyingChannel.getSourceChannel());
return true;
} catch (IOException e) {
UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
safeClose(connection);
return false;
}
}

Expand Down

0 comments on commit d5ed8b8

Please sign in to comment.