Skip to content

Commit

Permalink
Improve passthru warn logs for max payload size exceeding
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakith-Rambukkanage committed Apr 17, 2024
1 parent 530e0d1 commit 5c4e8dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public class PassThroughConstants {
public static final String HTTP_PUT = "PUT";
public static final String HTTP_OPTIONS = "OPTIONS";
public static final String HTTP_CONNECT = "CONNECT";
public static final String HTTP_METHOD = "HTTP_METHOD";

//Constant to specify the socket timeout
public static final String HTTP_SOCKET_TIMEOUT = "HTTP_SOCKET_TIMEOUT";
Expand Down Expand Up @@ -274,4 +275,5 @@ public class PassThroughConstants {
//default header that carries the correlation ID. Header name is configurable at passthru-http.properties
public static final String CORRELATION_DEFAULT_HEADER = "activityid";
public static final String TRANSPORT_LATENCY_LOGGER = "transport-latency";
public static final String TRANSPORT_IN_URL = "TransportInURL";
}
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ public void inputReady(NHttpServerConnection conn,

if (messageSizeSum > validMaxMessageSize) {
log.warn("Payload exceeds valid payload size range, hence discontinuing chunk stream at "
+ messageSizeSum + " bytes to prevent OOM.");
+ messageSizeSum + " bytes to prevent OOM for"
+ " URI : " + request.getUri()
+ ", Method : " + request.getMethod()
+ ", Correlation ID: " + request.getHeaders().get(PassThroughConstants.CORRELATION_DEFAULT_HEADER)
);
dropSourceConnection(conn);
metrics.exceptionOccured();
conn.getContext().setAttribute(PassThroughConstants.SOURCE_CONNECTION_DROPPED, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,11 @@ public void inputReady(NHttpClientConnection conn, ContentDecoder decoder) {

if (messageSizeSum > validMaxMessageSize) {
log.warn("Payload exceeds valid payload size range, hence discontinuing chunk stream at "
+ messageSizeSum + " bytes to prevent OOM.");
+ messageSizeSum + " bytes to prevent OOM for"
+ " URI : " + msgCtx.getProperty(PassThroughConstants.TRANSPORT_IN_URL)
+ ", Method : " + msgCtx.getProperty(PassThroughConstants.HTTP_METHOD)
+ ", Correlation ID: " + msgCtx.getProperty(CorrelationConstants.CORRELATION_ID)
);
dropTargetConnection(conn);
response.getPipe().forceProducerComplete(decoder);
}
Expand Down

0 comments on commit 5c4e8dd

Please sign in to comment.