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

Health check called on the event loop #4531

Closed
cescoffier opened this issue Oct 13, 2019 · 2 comments · Fixed by #4549
Closed

Health check called on the event loop #4531

cescoffier opened this issue Oct 13, 2019 · 2 comments · Fixed by #4549
Labels
kind/bug Something isn't working
Milestone

Comments

@cescoffier
Copy link
Member

Describe the bug

With the following class:

@Readiness
@ApplicationScoped
public class DatabaseConnectionHealthCheck implements HealthCheck {

    @Inject
    FightService fightService;

    @Override
    public HealthCheckResponse call() {
        HealthCheckResponseBuilder responseBuilder = HealthCheckResponse.named("Database connection health check");

        System.out.println("Thread: " + Thread.currentThread().getName());
        try {
            List<Fight> fights = fightService.findAllFights();
            responseBuilder.withData("Number of rows in the database", fights.size()).up();
        } catch (IllegalStateException e) {
            e.printStackTrace();
            responseBuilder.down();
        }

        return responseBuilder.build();
    }
}

The call fails because it tries to access the database from an IO Thread.

Expected behavior
It should use a worker thread.

Actual behavior
It uses the event loop thread

@cescoffier cescoffier added the kind/bug Something isn't working label Oct 13, 2019
@cescoffier cescoffier added this to the 0.25.0 milestone Oct 13, 2019
@cescoffier
Copy link
Member Author

The issue is that the route would also require the request scope.

@kenfinnigan
Copy link
Member

Can we define specific routes to execute on the worker instead of IO thread?

I presume it's fine to have /health and /metrics served from a worker thread instead?

cescoffier added a commit to cescoffier/quarkus that referenced this issue Oct 14, 2019
cescoffier added a commit to cescoffier/quarkus that referenced this issue Oct 14, 2019
As stated in the issue, the request scope must also be activated.
cescoffier added a commit to cescoffier/quarkus that referenced this issue Oct 14, 2019
As stated in the issue, the request scope must also be activated.
cescoffier added a commit to cescoffier/quarkus that referenced this issue Oct 14, 2019
As stated in the issue, the request scope must also be activated.
cescoffier added a commit to cescoffier/quarkus that referenced this issue Oct 14, 2019
As stated in the issue, the request scope must also be activated.
cescoffier added a commit to cescoffier/quarkus that referenced this issue Oct 14, 2019
As stated in the issue, the request scope must also be activated.
CSTDev pushed a commit to CSTDev/quarkus that referenced this issue Oct 22, 2019
As stated in the issue, the request scope must also be activated.
dufoli pushed a commit to dufoli/quarkus that referenced this issue Oct 23, 2019
As stated in the issue, the request scope must also be activated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants