Skip to content

Commit

Permalink
Merge pull request #1278 from ropalka/UNDERTOW-2002
Browse files Browse the repository at this point in the history
[UNDERTOW-2002] Fixing StackOverflowError upon AJP read timeout
  • Loading branch information
fl4via authored Feb 5, 2022
2 parents 6ae481e + d5ed8b8 commit fca2af5
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 fca2af5

Please sign in to comment.