Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid thread pinning in SseEmitter write operations #30996

Closed
bclozel opened this issue Aug 4, 2023 · 0 comments
Closed

Avoid thread pinning in SseEmitter write operations #30996

bclozel opened this issue Aug 4, 2023 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Aug 4, 2023

SseEmitter is guarding write operations to the response with a synchronized block. As explained in JEP 245, this behavior can cause the current virtual thread to be pinned to the underlying platform thread during the write operation.

We should use instead a ReentrantLock to prevent platform thread pinning on JDK 21 (if virtual threads are enabled).

@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Aug 4, 2023
@bclozel bclozel added this to the 6.1.0-M4 milestone Aug 4, 2023
@bclozel bclozel self-assigned this Aug 4, 2023
@bclozel bclozel closed this as completed in 646fd3e Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant