Skip to content

Commit 4bf2dfb

Browse files
Improve logging for ByteBufInputStream close failures
Change log level from debug to warn and catch Throwable instead of just IOException to make potential ByteBuf leak issues more visible. Co-authored-by: FabianMeiswinkel <[email protected]>
1 parent 861cb2a commit 4bf2dfb

File tree

1 file changed

+4
-4
lines changed
  • sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity

1 file changed

+4
-4
lines changed

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreResponse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ public StoreResponse(
7171
if (contentStream != null) {
7272
try {
7373
this.responsePayload = new JsonNodeStorePayload(contentStream, responsePayloadLength, headerMap);
74-
}
75-
finally {
74+
} finally {
7675
try {
7776
contentStream.close();
78-
} catch (IOException e) {
79-
logger.debug("Could not successfully close content stream.", e);
77+
} catch (Throwable e) {
78+
// Log as warning instead of debug to make ByteBuf leak issues more visible
79+
logger.warn("Failed to close content stream. This may cause a Netty ByteBuf leak.", e);
8080
}
8181
}
8282
} else {

0 commit comments

Comments
 (0)