jersey icon indicating copy to clipboard operation
jersey copied to clipboard

RequestEvent for RequestEventListener might lost request attributes for async flow

Open tutufool opened this issue 7 months ago • 5 comments

Screenshot 2024-07-09 at 22 40 03

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!

tutufool avatar Jul 09 '24 14:07 tutufool