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

Remove un-necessary Http1xServerConnection internal state synchronised access #5143

Merged

Conversation

vietj
Copy link
Member

@vietj vietj commented Mar 6, 2024

The Http1xServerConnection synchronize itself to guard the internal state of the request/response in progress.

Such synchronization used to be useful before Vert.x 4 and the clear dispatch between connection/request code. Currently read and writes are confined in the event-loop thread and removing this synchronization has no effect on the read/writes of this state.

…tate of the request/response in progress.

Such synchronization used to be useful before Vert.x 4 and the clear dispatch between connection/request code. Currently read and writes are confined in the event-loop thread and removing this synchronization has no effect on the read/writes of this state.
@vietj vietj added this to the 4.5.5 milestone Mar 6, 2024
@vietj vietj self-assigned this Mar 6, 2024
@franz1981
Copy link
Contributor

@vietj
Copy link
Member Author

vietj commented Mar 7, 2024

I think it should be fine for this case as we update the state of the request/response in progress and this sync and the request/close status which are not related to back-pressure/drain.

As said in the PR, the state we update in the synchronized block is accessed exclusively from the event-loop thread which is the reason we remove the synchronization. In addition none of these blocks calls another method.

Therefore it seems safe to me, WDYT ?

FYI: https://github.com/quarkusio/quarkus/blob/main/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/ResteasyReactiveOutputStream.java#L53

and check Http1xServerRequest as well, which is still synchronizing over conn -> the connection

@franz1981
Copy link
Contributor

franz1981 commented Mar 7, 2024

@vietj

the best way would be to try running some of the tests on Quarkus which relies on it, by using a vertx which version relax these properties (ie this PR) @geoand @cescoffier how it looks?

while re

and check Http1xServerRequest as well, which is still synchronizing over conn -> the connection

we have many other parts where we synchronize over connection within vertx, if we plan to remove this, I would go for the others as well

@vietj
Copy link
Member Author

vietj commented Mar 7, 2024

which others do you mean ?

in this PR I only meant to remove synchronised usage of state mutation that is confined to the event-loop thread which is a trivial decision

@franz1981
Copy link
Contributor

which others do you mean ?

Http1xServerRequest, for example

@vietj vietj modified the milestones: 4.5.5, 4.5.6 Mar 14, 2024
@vietj vietj modified the milestones: 4.5.6, 4.5.7, 4.5.8 Mar 21, 2024
Copy link
Contributor

@franz1981 franz1981 left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@vietj vietj merged commit f37aa24 into 4.x May 16, 2024
7 checks passed
@vietj vietj deleted the remove-un-necessary-http1-server-connection-synchronization-4.x branch May 16, 2024 12:19
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.

None yet

2 participants