spring-projects / spring-projects/spring-security

Multiple traces are generated for failing requests

Open
#12,610 1 comment 1 reaction 1 assignee View on GitHub

@jzheaux is already working on this.

Since Feb 2, 2023.

status: waiting-for-triage type: bug
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Describe the bug
When a REST request fails, duplicate traces are generated. This behavior exists for authentication errors (e.g. unauthenticated -> 401), as well as for other errors dispatching to the error page (e.g. wrong URL -> 404).
It seems that requests which are dispatched to the error page by the framework, get a fresh observation and thus traceId, instead of taking any existing observation which was generated by the initial request handling.

The result in Grafana looks similar to this:
example with 404
error-traces

Tested with SpringBoot 3.0.2, Spring Security 6.0.1

To Reproduce
Fire a request against a secured RestController method, without authentication token.
or
Fire a request with a wrong URL which will result in a 404.

Expected behavior
A single traceId should be generated, dispatched requests should reuse the original traceId

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.