jersey
jersey copied to clipboard
RequestEvent for RequestEventListener might lost request attributes for async flow
As you can see from above screen shot:
Thread A: request will be recycled ( attributes of request will be cleared) Thread B: try to get request attribute from container request.
(Put breakpoints in 2 threads as above screenshot shows, let thread A go first to reproduce.)
And this is a simple spring boot application with parent: (could happen in older spring boot version)
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.1</version>
Not sure if it's a known issue or expected behavior, please have a look.
And from the RequestEvent contract, it supposed to be able to get a stable ContainerRequest rather than a fragile one. I guess maybe we had a chance to clone/copy the request context somewhere instead of relying underlying tomcat request object.
Thanks in advance!