Has anyone ever had a good experience with transaction timeouts? I feel like they achieve nothing useful in that: 1. They don't interrupt any work that is taking too long (they just prevent it from being committed) 2. By the time the exception is thrown, all the work is already done and the result is that it just gets thrown away in exchange for an error
Surely there's a positive side to them, and I've just never seen it? But Nicolas, in your case I think the solution lies elsewhere. I don't think it's ever ok for a screen to take over a minute to load and tie up the http connection all that time. Slow pages happen to all of us, but IMO the solution always lies in making the screen faster, limiting the amount of data that can be processed in a single request or by making the request asynchronous. Regards Scott On Wed, 11 Sep 2019 at 06:57, Nicolas Malin <[email protected]> wrote: > Hi all, > > Since I increase the sensibility of error message [1], we have on > different screen that take some time to rendering an error throw due to > transaction timeout. > > By default each screen is rendering with the default timeout (60s) that > isn't enough when you have big data compilation or some external service > latency. > > Of course it's possible to analyze each case with purpose to increase > the screen velocity or set a transaction-timeout on screen definition, > but as first easy step what do you think if we add a default transaction > timeout for screen to 10 minutes with possibility to override by > properties ? > > Example: > > ***************************** > > > framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreen.java > @@ -122,7 +123,7 @@ public class ModelScreen extends ModelWidget { > // wrap the whole screen rendering in a transaction, should > improve performance in querying and such > Map<String, String> parameters = > UtilGenerics.cast(context.get("parameters")); > boolean beganTransaction = false; > - int transactionTimeout = -1; > + int transactionTimeout = > UtilProperties.getPropertyAsInteger("widget", > "widget.transaction.timeout.default", 600); > if (parameters != null) { > String transactionTimeoutPar = > parameters.get("TRANSACTION_TIMEOUT"); > if (transactionTimeoutPar != null) { > @@ -152,12 +153,7 @@ public class ModelScreen extends ModelWidget { > // If transaction timeout is present, use it to start the > transaction > // If transaction timeout is set to zero, no transaction > is started > if (useTransaction) { > - if (transactionTimeout < 0) { > - beganTransaction = TransactionUtil.begin(); > - } > - if (transactionTimeout > 0) { > - beganTransaction = > TransactionUtil.begin(transactionTimeout); > - } > + beganTransaction = > TransactionUtil.begin(transactionTimeout); > } > > // render the screen, starting with the top-level section > > ******************************* > > Any remarks ? > > In parallel i will investigate why the error message catch is so sensible. > > Nicolas > > [1] http://svn.apache.org/viewvc?view=revision&revision=1856175 > > -- > logoNrd <https://nereide.fr/> > Nicolas Malin > The apache way <http://theapacheway.com/> : *Charity* Apache’s mission > is providing software for the public good. > [email protected] > 8 rue des Déportés 37000 TOURS, 02 47 50 30 54 > > Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way > <http://theapacheway.com/>|réseau LE <http://www.libre-entreprise.org/> >
