-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
A custom log format, defined by quarkus.log.console.format, ensures that every log entry related to an incoming REST request includes the traceId:
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{3.}] (%t) traceId=%X{traceId} %s%e%n
Ideally, all log entries produced while handling a single request should consistently carry the same traceId.
However, if a client disconnects early due to a read timeout, the server continues processing, but subsequent log entries lose the traceId. This breaks traceability for those log messages.
Likewise, any OpenTelemetry spans created after the timeout are no longer associated with the original trace, breaking end-to-end trace continuity.
Expected behavior
Taken this GreetingEndpoint as an example:
@Path("/hello")
public class GreetingResource {
private static final Logger LOG = Logger.getLogger(GreetingResource.class);
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
LOG.info("Received request at hello endpoint, simulating slowness by sleeping for 5 seconds...");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
LOG.info("Returning response from hello endpoint.");
return "Hello from Quarkus REST";
}
}
The expectation is to have any logs produced by the endpoint implementation to include the traceId:
2025-11-10 15:33:23,025 INFO [com.tim.sam.GreetingResource] (executor-thread-1) traceId=452d27528bd1dc64ada7d2f51cfc74ee Received request at hello endpoint, simulating slowness by sleeping for 5 seconds...
2025-11-10 15:33:28,025 INFO [com.tim.sam.GreetingResource] (executor-thread-1) traceId=452d27528bd1dc64ada7d2f51cfc74ee Returning response from hello endpoint.
Actual behavior
If the server is slow to respond and the client early close the connection due to a read timeout, the server continues processing the request, but log entries that follows the read-timeout no longer include the traceID:
2025-11-10 15:33:23,025 INFO [com.tim.sam.GreetingResource] (executor-thread-1) traceId=452d27528bd1dc64ada7d2f51cfc74ee Received request at hello endpoint, simulating slowness by sleeping for 5 seconds...
2025-11-10 15:33:28,025 INFO [com.tim.sam.GreetingResource] (executor-thread-1) traceId= Returning response from hello endpoint.
How to Reproduce?
The following file is a reproducer application.
Please refer to the README.md file for detailed instructions on how to use it.
Output of uname -a or ver
MacOS 15.7.1
Output of java -version
openjdk version "21.0.5" 2024-10-15 LTS
Quarkus version or git rev
3.20.3
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.9.6
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status