Avoid thread pinning in SseEmitter, ResponseBodyEmitter#35423
Closed
acktsap wants to merge 1 commit into
Closed
Conversation
acktsap
commented
Sep 4, 2025
| private static final MediaType TEXT_PLAIN = new MediaType("text", "plain", StandardCharsets.UTF_8); | ||
|
|
||
| /** Guards access to write operations on the response. */ | ||
| private final Lock writeLock = new ReentrantLock(); |
Contributor
Author
There was a problem hiding this comment.
I just moved this field to the upper level & changed it to protected
80535b1 to
f9a40be
Compare
Member
|
@acktsap please run the build locally before submitting a PR: |
Closes spring-projectsgh-35422 Signed-off-by: Taeik Lim <sibera21@gmail.com>
f9a40be to
ebce252
Compare
Contributor
Author
Completed |
Contributor
|
Fixed via c788554 |
Member
|
Thanks for raising this @acktsap , this is now merged. |
kilink
reviewed
Sep 11, 2025
| */ | ||
| public synchronized void send(Object object, @Nullable MediaType mediaType) throws IOException { | ||
| public void send(Object object, @Nullable MediaType mediaType) throws IOException { | ||
| Assert.state(!this.complete, () -> "ResponseBodyEmitter has already completed" + |
Contributor
There was a problem hiding this comment.
This is reading plain fields now with no synchronization
Contributor
There was a problem hiding this comment.
To clarify, I think it has introduced a bug, since the complete and failure fields aren't read while holding the lock.
bclozel
added a commit
that referenced
this pull request
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes gh-35422