-
Notifications
You must be signed in to change notification settings - Fork 36
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
make ThreadTimer not singleton again #1048
Conversation
@rhusar Here's the fix for singleton |
3309c95
to
a9491db
Compare
Thanks, I ll have a look and report back. |
This is for multi-deployment environments, like WildFly, where multiple applications may exist and each will have its own timer.
a9491db
to
b8571a9
Compare
Hi @rhusar, any news? |
@Ladicek TBH having a bit of a problem reproducing this, can you elaborate the conditions that are necessary to trigger this? Basically I have 2 concurrent deployment both using a Retry, but that doesn't trigger the problem. |
Humm, OK, that's weird. Did you try to call the |
Yes. I am starting to think there is another condition required to trigger the Lazy resolution bit.. Also, in the user report this appears to not require calling the methods since this happens in |
Ah right, good point. The timer is created eagerly. Well, then I don't know what's the issue... |
Orignal Issue-Reporter in zulip here: We have bound the Retry to a reactive-Messaging channel, I can try to strip that down to a sharable example, but I do not have the time to do that today (CEST timezone). |
Thanks @mmusenbr, that would be immensely helpful (the reactive messaging subsystem was added after integrating MP Fault Tolerance so I guess that's why we don't have this covered in WildFly test suite better..) |
So I'm not exactly sure what I'm doing wrong, but I can deploy 2 apps using SmallRye Fault Tolerance without a problem. It is only when I call both applications when I'm getting the exception. Not what I would have expected, but good enough I guess. The reproducer is the simplest webapp you can imagine, I don't really feel like creating a GitHub repo, so just a listing of files here:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cz.ladicek</groupId>
<artifactId>fttest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.fault-tolerance</groupId>
<artifactId>microprofile-fault-tolerance-api</artifactId>
<version>4.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
package cz.ladicek.fttest;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
@ApplicationPath("/")
public class MyApplication extends Application {
}
package cz.ladicek.fttest;
import jakarta.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.faulttolerance.Retry;
@ApplicationScoped
public class MyBean {
@Retry
public String hello() {
return "hello";
}
}
package cz.ladicek.fttest;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
@Path("/")
public class MyResource {
@Inject
MyBean bean;
@GET
public String get() {
return bean.hello();
}
}
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app> Running |
With this PR, the exception no longer occurs. Looks good enough to me. |
Sounds good. I was packaging these in an EAR (to avoid some test fwk limitations) so perhaps that has an effect too and some sharing is going on in an EAR, even though it does "start" SR FT twice as per logs. I ll update the test now. |
Oh I have no idea how that works in an EAR. Two separately deployed WARs certainly trigger the problem. |
@Ladicek Just rewritten the test to use separate top-level deployments = they fail and pass with the fix. So clearly, there is some context sharing going on in an EAR that doesn't trigger this. Excellent, now we will just wait for 6.4.1 whenever we can get it ;-) FYI @mmusenbr no need for the reproducer, thx! |
Sorry to be joining the party too late. We do have a failing test which is a good reproducer, here: https://github.com/jboss-eap-qe/eap-microprofile-test-suite/blob/master/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/UndeployDeployTest.java#L125 @rhusar do we have a WFLY tracking this issue (and one for the required version bump, BTW)? |
If only it ran on CI ;-) Yes, the issues are: |
Eh... we're working on it 🥲
Thanks! |
This is for multi-deployment environments, like WildFly, where multiple applications may exist and each will have its own timer.
Fixes #1047