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

Comments

@cescoffier
Copy link
Member

@cescoffier cescoffier commented Oct 13, 2019

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 bug label Oct 13, 2019
@cescoffier cescoffier added this to the 0.25.0 milestone Oct 13, 2019
@cescoffier

This comment has been minimized.

Copy link
Member Author

@cescoffier cescoffier commented Oct 13, 2019

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

@kenfinnigan

This comment has been minimized.

Copy link
Member

@kenfinnigan kenfinnigan commented Oct 13, 2019

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 added 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.
vsevel added a commit to vsevel/quarkus that referenced this issue Nov 18, 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
Projects
None yet
2 participants
You can’t perform that action at this time.