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

Make sure request resumes on correct thread #10176

Merged
merged 2 commits into from
Jul 8, 2020

Conversation

stuartwdouglas
Copy link
Member

Fixes #9693

@gastaldi
Copy link
Contributor

Your PR failed because of a code formatting failure which was pushed to master (weird that the PR checks didn't catch them). I fixed in #10175

@gastaldi
Copy link
Contributor

Thanks, now please rebase this PR ;)

@geoand
Copy link
Contributor

geoand commented Jun 23, 2020

It seems like CustomRoleDecoderDevModeTest is failing

@tsegismont
Copy link
Contributor

@stuartwdouglas this change works around the issue with BodyHandler, but we may still have problems if, for example, user or extension code invokes executeBlocking on the Vert.x instance bound to the Router.

@gsmet
Copy link
Member

gsmet commented Jun 24, 2020

This looks like something we really want in CR1.

@gsmet gsmet modified the milestone: 1.6.0 - master Jun 24, 2020
@phillip-kruger
Copy link
Member

This looks like something we really want in CR1.

Yes please !!

@phillip-kruger
Copy link
Member

This will also fix #10452

@gsmet
Copy link
Member

gsmet commented Jul 6, 2020

I just rebased that one.

Stuart, where are we on this one? AFAICS the tests were failing and given the error message, I think it's related.

@tsegismont
Copy link
Contributor

@gsmet there's an ongoing discussion on Zulip about what's the proper fix for the issue. In a few words, the changes in this PR fix the symptom observed in #9693 but not the cause.

@stuartwdouglas
Copy link
Member Author

I think I have a fix for these failing tests, but we also need to look at preserving the vert.x instance. This will be a seperate PR though, as this is more complex.

@stuartwdouglas
Copy link
Member Author

I have added another commit that will limit us to a single vert.x, lets see what CI says

@stuartwdouglas
Copy link
Member Author

@gsmet should be good to go now.

@@ -39,7 +40,8 @@ void handleHotReplacementRequest(RoutingContext routingContext) {
routingContext.next();
return;
}
routingContext.vertx().executeBlocking(new Handler<Promise<Boolean>>() {
ConnectionBase connectionBase = (ConnectionBase) routingContext.request().connection();
Copy link
Contributor

Choose a reason for hiding this comment

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

This change shouldn't be needed anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is, the old code could resume on a different IO thread in the same vert.x instance, this makes sure it is the same thread that will be delivering the IO notifications.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I can't see how, do you have a simple example in mind?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually the original code should be safe now, as it stores the original context. Either way though this code is fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

.then().statusCode(200)
.body(Matchers.equalTo("test route"));

runner.modifySourceFile(TestRoute.class, new Function<String, String>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about updating TestRoute so that the handler calls executing blocking, and we verify that the context when calling executingBlocking and when the callback is involved is the same:

Vertx vertx = rc.vertx()
expected = vertx.getOrCreateContext();
vertx.executeBlocking(Promise::complete, ar -> {
  actual = vertx.getOrCreateContext();
  // expected should be the same as actual
  // before AND after hot reload
})

Copy link
Member Author

Choose a reason for hiding this comment

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

I have updated the test to verify the connection vertx instance matches the current vertx instance.

Copy link
Contributor

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

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

Thanks @stuartwdouglas !

@geoand geoand added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Jul 8, 2020
@stuartwdouglas stuartwdouglas merged commit 25c6a78 into quarkusio:master Jul 8, 2020
@stuartwdouglas stuartwdouglas added this to the 1.7.0 - master milestone Jul 8, 2020
@gsmet gsmet modified the milestones: 1.7.0 - master, 1.6.1.Final Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core area/vertx triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hot reload crashes using dev mode with vert.x-web extension
6 participants