Skip to content

servlet: simplify synchronization in AsyncServletOutputStreamWriter #12284

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

Closed
wants to merge 1 commit into from

Conversation

panchenko
Copy link
Contributor

@panchenko panchenko commented Aug 17, 2025

Currently synchronization is too low level, seems like can be simplified by using standard lock implementation.

@panchenko panchenko changed the title servlet: simplify synchronisation in AsyncServletOutputStreamWriter servlet: simplify synchronization in AsyncServletOutputStreamWriter Aug 17, 2025
@panchenko panchenko force-pushed the use-lock-in-servlet branch 3 times, most recently from 7c5e6ab to 3734a01 Compare August 19, 2025 14:28
@panchenko panchenko force-pushed the use-lock-in-servlet branch from 3734a01 to a3ba516 Compare August 19, 2025 15:06
@panchenko panchenko marked this pull request as ready for review August 19, 2025 15:34
@panchenko panchenko marked this pull request as draft August 22, 2025 12:25
if (toWrite != null) {
toWrite.run();
if (toWrite == completeAction) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the earlier code, while returning from completeAction the unpacking of the locked thread was not done but now we are releasing the lock and always letting the container thread be unlocked and run the code in onWritePossible. Seems ok, just pointing out the difference as you probably know this code better.

@panchenko
Copy link
Contributor Author

There are still race conditions in this code.

@panchenko panchenko closed this Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants