From 6efe404bd6d674e26ba564d615cfb4cdefa1570c Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Tue, 5 Jan 2021 20:38:06 +0100 Subject: [PATCH] Removing the flush() method. It appears to not prevent transaction timeouts. Also documenting how to extend transaction timeouts in Wildfly --- docs/troubleshooting.md | 27 +++++++++++++++++++ .../controller/session/ForecastBean.java | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 docs/troubleshooting.md diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md new file mode 100644 index 00000000..59e66437 --- /dev/null +++ b/docs/troubleshooting.md @@ -0,0 +1,27 @@ +#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 diff --git a/src/main/java/no/nibio/vips/logic/controller/session/ForecastBean.java b/src/main/java/no/nibio/vips/logic/controller/session/ForecastBean.java index c7cb8912..84f69950 100755 --- a/src/main/java/no/nibio/vips/logic/controller/session/ForecastBean.java +++ b/src/main/java/no/nibio/vips/logic/controller/session/ForecastBean.java @@ -50,6 +50,7 @@ import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; import javax.persistence.Query; +import javax.transaction.Transactional; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; @@ -956,7 +957,7 @@ public class ForecastBean { } } - em.flush(); + //em.flush(); } if(activeForecastIds != null && ! activeForecastIds.isEmpty()) -- GitLab