Skip to content
Snippets Groups Projects
Commit 6efe404b authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Removing the flush() method. It appears to not prevent transaction

timeouts. Also documenting how to extend transaction timeouts in Wildfly
parent 96e794c9
No related branches found
No related tags found
No related merge requests found
#Troubleshooting
##Transaction timeouts
If you get weird errors when running jobs, e.g. like this:
```
2021-01-05 18:34:48,916 WARN [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA012117: TransactionReaper::chec
k timeout for TX 0:ffff8027c039:65d436c5:5ff4a101:6f in state RUN
2021-01-05 18:34:48,925 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012095: Abort of actio
n id 0:ffff8027c039:65d436c5:5ff4a101:6f invoked while multiple threads active within it.
[...]
```
...this may be because the JEE application server has a transaction timeout. In WildFly (at least in Wildfly 16), the default timeout is 300 seconds. This can be adjusted, e.g. in standalone.xml. In the transaction subsystem add the `default-timeout="900"` attribute inside the `<coordinator-environment>` element below. 900 seconds equals 15 minutes.
```xml
<subsystem xmlns="urn:jboss:domain:transactions:5.0">
<core-environment node-identifier="${jboss.tx.node.id:1}">
<process-id>
<uuid/>
</process-id>
</core-environment>
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
<coordinator-environment default-timeout="1000" statistics-enabled="${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<object-store path="tx-object-store" relative-to="jboss.server.data.dir"/>
</subsystem>
```
\ No newline at end of file
...@@ -50,6 +50,7 @@ import javax.persistence.EntityManager; ...@@ -50,6 +50,7 @@ import javax.persistence.EntityManager;
import javax.persistence.NoResultException; import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.Query; import javax.persistence.Query;
import javax.transaction.Transactional;
import javax.ws.rs.client.Client; import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget; import javax.ws.rs.client.WebTarget;
...@@ -956,7 +957,7 @@ public class ForecastBean { ...@@ -956,7 +957,7 @@ public class ForecastBean {
} }
} }
em.flush(); //em.flush();
} }
if(activeForecastIds != null && ! activeForecastIds.isEmpty()) if(activeForecastIds != null && ! activeForecastIds.isEmpty())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment