Skip to content

Commit 4a2bd4d

Browse files
committed
Fix async blocking flag set before commit confirmation
NettyBlockResponseFunction.tryCommitBlockingResponse() marked blockingResponseInitiated = true immediately after scheduling the off-event-loop commitBlockingResponse() call, without waiting for it to actually run. If that async commit failed once executed, the failure was silently swallowed and every later tryBlock() call for the same request would short-circuit to true, hiding the failure from block_failure telemetry. The flag is now set only inside the scheduled task, after commitBlockingResponse() actually returns true, matching the same-thread branch's existing behavior.
1 parent cdd1140 commit 4a2bd4d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎dd-java-agent/instrumentation/netty/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/server/NettyHttpServerDecorator.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ public boolean tryCommitBlockingResponse(
164164
.channel()
165165
.eventLoop()
166166
.execute(
167-
() ->
168-
commitBlockingResponse(
169-
segment, statusCode, templateType, extraHeaders, securityResponseId));
170-
blockingResponseInitiated = true;
167+
() -> {
168+
if (commitBlockingResponse(
169+
segment, statusCode, templateType, extraHeaders, securityResponseId)) {
170+
blockingResponseInitiated = true;
171+
}
172+
});
171173
return true;
172174
} catch (RuntimeException rte) {
173175
log.warn("Failed scheduling blocking handler", rte);

0 commit comments

Comments
 (0)