Closed rsvoboda closed 5 years ago
It looks related to context propagation and maybe ArC.
@mkouba @FroMage ?
Isn't there another issue about this that we fixed?
I use latest master
It's definitely related to context propagation. From what I see in the stack the JtaContextProvider
attempts to use ArC after the container was shut down. A similar issue was in ArcContextProvider
- see https://github.com/quarkusio/quarkus/issues/2696.
There is no exception when only quarkus-smallrye-fault-tolerance is enabled.
Yes, that confirms my assumption that it's a bug in JtaContextProvider
.
So JtaContextProvider
should be updated with a similar fix? What's weird here is that this seems to be hapening due to running cleanup, so perhaps it's a cleanup ordering issue?
Seems to me that HystrixThreadEventStream.getInstance().shutdown()
is also technically invalid, because it will create a new threadlocal (this is what happens here) just to shut it down. There seems to be no way to check if that creation is required, though.
@mmusgrov do you agree we should add specific behaviour when CDI is present but there's no transaction manager? I can probably fix this.
attempts to use ArC after the container was shut down
We call:
private boolean isCdiUnavailable() {
try {
return CDI.current() == null;
} catch (IllegalStateException e) {
// no CDI provider found, CDI isn't available
return true;
}
}
This is not the right way to do it?
This should be a portable way. If you don't need to be portable, just use Arc.container() != null
.
I'll fix our CDIProvider
to throw ISE if it's not available.
Ah, ArcContextProvider
now calls
ArcContainer arc = Arc.container();
if (arc == null || !arc.isRunning()) {
But CDI does not appear to have that, is this true @mkouba ?
This needs to be portable, it's not in quarkus.
OK, if your fix to CDIProvider
is enough to fix this, then it's much easier than the alternatives :)
I'll send a PR shortly...
Trying out the PR with the problematic example project.
And I confirm it fixes the issue.
I see
java.lang.IllegalArgumentException
thrown at the end of test phase whenquarkus-hibernate-orm
andquarkus-smallrye-fault-tolerance
are enabled.Stacktrace includes keywords like HystrixThreadEventStream and io.quarkus.smallrye.faulttolerance. This error message is present only if quarkus-hibernate-orm extension is used too. There is no exception when only quarkus-smallrye-fault-tolerance is enabled.