Replies: 5 comments 9 replies
-
Those two solutions look good. I agree that we should not reactivate terminated contexts. The question will be whether to throw when this happens or not. We could throw when this happens. If we don't throw, and:
So perhaps it's best to not throw. A third solution is to not capture the request context in that method, using https://quarkus.io/guides/context-propagation#overriding-the-propagated-contexts-using-annotations |
Beta Was this translation helpful? Give feedback.
-
In fact, we could introduce a more general annotation that would allow to specify various requirements, e.g. something like |
Beta Was this translation helpful? Give feedback.
-
@mkouba I am not sure I understand who'd be responsible for invocation of I think the main issue here is how we stop Mutiny from reusing the same context endlessly and whether we want the context to be by default propagated for these infinite scenarios (I don't think so) or whether we want users to explicitly declare it. |
Beta Was this translation helpful? Give feedback.
-
Not meaning to derail this too much, but would it be possible to restrict / validate the possible scopes of some components? So to guide the end users into catching mistakes in scope and lifecycle expectations. For example:
I haven't thought it through, scopes are really not my area of expertise, but I hope we could validate at least some special cases to bail out at build time? |
Beta Was this translation helpful? Give feedback.
-
While working on #23300 we've identified a problem with CP and a deferred infinite
Multi
. In short, a request context map leaks from aStartupEvent
observer notification, due to use of a deferredMulti
that handles infinite stream. In other words, the context map is captured and then used forever. As a consequence, whenever a request scoped bean is used in a Multi callback a bean instance is created and never destroyed.@cescoffier is working on a fix for Reactive Messaging but I believe that it's a general problem that deserves a more robust solution.
First, I'd propose to add an
isValid()
method to theio.quarkus.arc.InjectableContext.ContextState
and skip the context activation in theArcContextProvider
wherever needed. Possibly also log a warning or something like that.We could also introduce a new annotation to mark a business method to be executed with no request context active, e.g.
@DeactivateRequestContext
(in contrast with@javax.enterprise.context.control.ActivateRequestContext
). Functionally similar to@Transactional(TxType.NOT_SUPPORTED)
. That would allow users to effectively ignore context propagation inside a bussiness method invocation.Any other ideas, concerns?
Beta Was this translation helpful? Give feedback.
All reactions