Comments (12)
Ah the README in the reproducer has an interesting bit of information: the issue occurs when calling the health check, but when calling any other endpoint, it doesn't. So the links above are indeed very much relevant.
from quarkus.
I'll clone the reproducer and will investigate properly, but at the first sight, the
@ActivateRequestContext
annotation on a@RequestScoped
bean seems 1. unnecessary, 2. potentially dangerous.Also, the fact that a request-scoped bean is injected anywhere or what's the scope of the bean that injects it should not matter. A request-scoped bean must be destroyed when the request context terminates.
Hi @Ladicek ,
Sorry, the @ActivateRequestContext
is an attempt of workaround (that did not work). Removing it from the sample. Thanks for the help :)
from quarkus.
@olivierbeltrandocintoo There was another issue that collided with this and will be fixed with #38888. With this PR, your reproducer works.
@gsmet I will need to fix it. In SR Health, when you invoke health, we compute a Uni for every major health group, let's say for readiness, we have readinessUni that is saved. On the next invocation, we just return this saved readinessUni once called again so Quarkus can resubscribe and call all end Uni subscriptions (health checks) again. But we save the finding and collecting of health checks into a parent Uni.
from quarkus.
/cc @Ladicek (smallrye), @geoand (kotlin), @jmartisk (health,smallrye), @phillip-kruger (smallrye), @radcortez (smallrye), @xstefank (health)
from quarkus.
I'll clone the reproducer and will investigate properly, but at the first sight, the @ActivateRequestContext
annotation on a @RequestScoped
bean seems 1. unnecessary, 2. potentially dangerous.
Also, the fact that a request-scoped bean is injected anywhere or what's the scope of the bean that injects it should not matter. A request-scoped bean must be destroyed when the request context terminates.
from quarkus.
@Ladicek for your awareness, if you are having a look to this one. There are a few other oddities in progress:
Might not be related but better have the big picture :)
from quarkus.
Thanks @gsmet, I'll keep that in mind!
from quarkus.
This is caused by manual Uni caching done in SmallRye Health for performance reasons. To correctly handle CDI context propagation, you need to set the quarkus.smallrye-health.context-propagation=true
property - https://quarkus.io/guides/smallrye-health#context-propagation-into-the-health-check-invocations. We should add a warning if the user attempts to use CDI without this flag or maybe we should change the default to recreate Unis and just allow to set caching explicitly. WDYT @cescoffier I think that you originally proposed Uni caching in Health.
from quarkus.
Caching is fine if you handle the duplicated context correctly - See #37077
from quarkus.
Hello @xstefank , I have tried adding the property quarkus.smallrye-health.context-propagation=true
in the application.properties
but the issue persists -> Ie. the @PreDestroy
is not called.
You can test on the provided reproducer :)
- add the line in the properties file
mvn clean quarkus:dev
- call http://localhost:8080/q/health/ 3 times, the 4th time it is going to get DOWN -> see logs to check that the message
endOfRequest called
is missing
from quarkus.
This is caused by manual Uni caching done in SmallRye Health for performance reasons.
What exactly are you caching?
from quarkus.
Hi ! I run the reproducer against Quarkus 3.7.4 that contains the fix #38888 and you are totally right, the @PreDestroy
related to the RequestContext is invoked now :) !
And you were also right: the quarkus.smallrye-health.context-propagation=true
needs to be set.
Thanks a lot.
Cheers,
Olivier
from quarkus.
Related Issues (20)
- Hibernate Reactive can't persist a many-to-many relation when one of the entities is a child (with the "joined" inheritance type) and the batch size is greater than 1 HOT 10
- Postgresql bump causing detection of instance Random/SplittableRandom HOT 11
- jpamodelgen fails with range out of bounds HOT 9
- Properly pass errors from JsonRPC backends to Dev UI HOT 2
- Unable to build a container with Jib when podman is running HOT 7
- Exception thrown when stopping devmode and with dev services running with Podman HOT 1
- Quarkus opentelemetry extension WARNING when exporting to dynatrace HOT 11
- GRPC server doesn't respond when running on the same server as HTTP and using TLS HOT 6
- Add @PermissionsAllowed to Panache Resources HOT 9
- Native: Introduce flag to favor build time improvements at the cost of using more resources and vice versa HOT 4
- Prevent API scraping through obscurity HOT 2
- Decorating MongoClient does not work because decorator is removed during build HOT 3
- Jakarta RESTful Web Services 3.1 Multipart support does not work HOT 7
- Wrong duplicateEndPoint when implements two Rest interfaces HOT 7
- Quarkus SmallRye GraphQL not emitting metrics HOT 2
- Use Arc AnnotationStore to build Hibernate ORM metadata HOT 25
- Mockito fails to mock non-public inner class in continuous testing due to classloading issues HOT 8
- cert chain public key resolver thumbprints HOT 4
- Quarkus 3.7.4 java.lang.ClassNotFoundException when running devsevices with gradle HOT 14
- Better error message for @ParameterizedTest failures in a @QuarkusTest HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quarkus.