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 that management router is reloaded #41353

Merged

Conversation

marko-bekhta
Copy link
Contributor

fixes #41315

I'm opening this as a draft only, as that's probably a bad idea for the fix 🙈 😕 but then ... it helps.

Copy link
Member

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

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

I can't see anything wrong. Not sure it helps, except removing routes during the hot reload.

@@ -567,7 +581,8 @@ public void handle(RoutingContext event) {

event.select(ManagementInterface.class).fire(new ManagementInterfaceImpl(managementRouter.getValue()));

VertxHttpRecorder.managementRouter = handler;
VertxHttpRecorder.managementRouterDelegate = handler;
VertxHttpRecorder.managementRouter = e -> VertxHttpRecorder.managementRouterDelegate.handle(e);
Copy link
Member

Choose a reason for hiding this comment

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

Probably better avoid the lambda here.

@marko-bekhta
Copy link
Contributor Author

Hey Clement 😃 👋🏻,

Thanks for taking a look at this one.

Not sure it helps, except removing routes during the hot reload.

I've been testing it on the search.quarkus.io app and the change helped there, both with adding/removing management endpoints and with modifying the handler.

I found this test for live-reload https://github.com/quarkusio/quarkus/blob/main/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devmode/LiveReloadArtifactTest.java, so will try to add some tests using a similar approach to cover some of the management endpoint reload scenarios.

@Override
public void handle(RoutingContext event) {
Thread.currentThread().setContextClassLoader(currentCl);
hotReplacementHandler.handle(event);
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised we don't restore the previous CL, here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can only assume that it's probably so that all subsequent handlers would run with this currentCl and it could be restored in the very last handler, but there's probably not much benefit in that?

@cescoffier
Copy link
Member

+1 for having a dedicated test.

@marko-bekhta marko-bekhta force-pushed the fix/i41315-management-handler-reload branch 2 times, most recently from 7734ec8 to 2e46aa0 Compare June 24, 2024 19:38
... and decide in the recorder whether we will actually keep that management router or not.
@marko-bekhta marko-bekhta force-pushed the fix/i41315-management-handler-reload branch from 2e46aa0 to a9f6135 Compare June 25, 2024 06:50
@marko-bekhta marko-bekhta marked this pull request as ready for review June 25, 2024 06:50
@marko-bekhta
Copy link
Contributor Author

I've rebased the PR and marked it as ready-for-review since ... you've been reviewing it 😃

@gsmet gsmet merged commit 2d02110 into quarkusio:main Jun 26, 2024
65 of 67 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.13 - main milestone Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants