[OFBiz] Users - Transaction timeout

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[OFBiz] Users - Transaction timeout

Christopher Farley
I've been having problems with transactions timing out. I first noticed
this when trying to import large XML files. I am now trying to create a
screen widget that calls a script that can take a while to execute. I am
getting what I believe to be transaction timeout errors.

The not-too-helpful error message returned to the UI is: [problem creating the newEntity value: SQL Exception occurred on commit (Cannot commit a transactional connection: See JDBC 2.0 Optional Package Specification section 7.1 (p25))]

This happens after about 65-70 seconds consistently. If I break the task
down to smaller data sets that execute faster than this, everything works
as expected, so I'm pretty sure I am not feeding corrupt data.

To set the TRANSACTION_TIMEOUT in a screen, I have been doing something
like this:

<screen name="Whatever">
    <actions>
        <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/>
    </actions>

    ....

</screen>


This seems to have no effect. I added a debug statement to the
TransactionUtil class, and the begin() method is always being called
with a value of "0".

Is this the proper way to change the transaction timeout? Is there something
else that might be timing out? Thanks for any help you can give...

--
Christopher Farley
www.northernbrewer.com
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Users - Transaction timeout

Jacopo Cappellato
Hi Christopher,

I too have noticed something similar and I'd like to help you find what
is causing this problem.
First of all:

the value that you set in the TRANSACTION_TIMEOUT parameter is used in
the following class:

framework\widget\src\org\ofbiz\widget\screen\ModelScreen.java

in the method "renderScreenString" (line 120)

Could you try to add a few debug statements in that class to see if the
parameter is correctly used?
Also, you could test the value of the "beganTransaction" boolean
variable returned in line 120:

beganTransaction = TransactionUtil.begin(transactionTimeout);

If it is false, this means that the transaction has been already started
(with a different transaction timeout?) in a different place... if this
is the case, maybe the transaction timeout set in line 120 is ignored?

Hope this helps,

Jacopo


Christopher Farley wrote:

> I've been having problems with transactions timing out. I first noticed
> this when trying to import large XML files. I am now trying to create a
> screen widget that calls a script that can take a while to execute. I am
> getting what I believe to be transaction timeout errors.
>
> The not-too-helpful error message returned to the UI is: [problem creating the newEntity value: SQL Exception occurred on commit (Cannot commit a transactional connection: See JDBC 2.0 Optional Package Specification section 7.1 (p25))]
>
> This happens after about 65-70 seconds consistently. If I break the task
> down to smaller data sets that execute faster than this, everything works
> as expected, so I'm pretty sure I am not feeding corrupt data.
>
> To set the TRANSACTION_TIMEOUT in a screen, I have been doing something
> like this:
>
> <screen name="Whatever">
>     <actions>
>         <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/>
>     </actions>
>
>     ....
>
> </screen>
>
>
> This seems to have no effect. I added a debug statement to the
> TransactionUtil class, and the begin() method is always being called
> with a value of "0".
>
> Is this the proper way to change the transaction timeout? Is there something
> else that might be timing out? Thanks for any help you can give...
>

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Users - Transaction timeout

David E. Jones

The reason setting it there in a screen widget set action didn't work  
is because the actions run _after_ the transaction is begun. It has  
to be that way because other things run in those actions that must be  
in a transaction.

There are other ways of doing this more generally, like setting a  
context parameter in the web.xml file called TRANSACTION_TIMEOUT.  
However, for a single screen there was no way of doing this directly,  
so in rev 6119 I added a transaction-timeout attribute to the screen  
element in the screen def XML files. Just specify the number of  
seconds for the timeout there. You can also use the  
FlexibleStringExpander syntax in it (ie ${whatever}).

Enjoy...

-David


On Nov 13, 2005, at 5:59 AM, Jacopo Cappellato wrote:

> Hi Christopher,
>
> I too have noticed something similar and I'd like to help you find  
> what is causing this problem.
> First of all:
>
> the value that you set in the TRANSACTION_TIMEOUT parameter is used  
> in the following class:
>
> framework\widget\src\org\ofbiz\widget\screen\ModelScreen.java
>
> in the method "renderScreenString" (line 120)
>
> Could you try to add a few debug statements in that class to see if  
> the parameter is correctly used?
> Also, you could test the value of the "beganTransaction" boolean  
> variable returned in line 120:
>
> beganTransaction = TransactionUtil.begin(transactionTimeout);
>
> If it is false, this means that the transaction has been already  
> started (with a different transaction timeout?) in a different  
> place... if this is the case, maybe the transaction timeout set in  
> line 120 is ignored?
>
> Hope this helps,
>
> Jacopo
>
>
> Christopher Farley wrote:
>> I've been having problems with transactions timing out. I first  
>> noticed this when trying to import large XML files. I am now  
>> trying to create a screen widget that calls a script that can take  
>> a while to execute. I am
>> getting what I believe to be transaction timeout errors.
>> The not-too-helpful error message returned to the UI is: [problem  
>> creating the newEntity value: SQL Exception occurred on commit  
>> (Cannot commit a transactional connection: See JDBC 2.0 Optional  
>> Package Specification section 7.1 (p25))]
>> This happens after about 65-70 seconds consistently. If I break  
>> the task
>> down to smaller data sets that execute faster than this,  
>> everything works
>> as expected, so I'm pretty sure I am not feeding corrupt data.
>> To set the TRANSACTION_TIMEOUT in a screen, I have been doing  
>> something
>> like this:
>> <screen name="Whatever">
>>     <actions>
>>         <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/>
>>     </actions>
>>     ....
>> </screen>
>> This seems to have no effect. I added a debug statement to the  
>> TransactionUtil class, and the begin() method is always being called
>> with a value of "0". Is this the proper way to change the  
>> transaction timeout? Is there something
>> else that might be timing out? Thanks for any help you can give...
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Users - Transaction timeout

Jacopo Cappellato
David,

thanks for your help! I'm going to try to use the new attribute.

By the way, reading the commit log it seems to me that the new
transaction-timeout attribute is used to set timeout in the same way the
parameters.TRANSACTION_TIMEOUT was used, i.e. they both set the
transactionTimeout variable to call the:

TransactionUtil.begin(transactionTimeout);

in the ModelScreen.renderScreenString method.

Since I'm rather sure (I think I've tested it) that, when the
TRANSACTION_TIMEOUT is set in the screen's action, the value is
available in the ModelScreen.renderScreenString method... I'm not too
sure this will resolve the issue.

Ok, I'll let you know!

Thanks,

Jacopo



David E. Jones wrote:

>
> The reason setting it there in a screen widget set action didn't work  
> is because the actions run _after_ the transaction is begun. It has  to
> be that way because other things run in those actions that must be  in a
> transaction.
>
> There are other ways of doing this more generally, like setting a  
> context parameter in the web.xml file called TRANSACTION_TIMEOUT.  
> However, for a single screen there was no way of doing this directly,  
> so in rev 6119 I added a transaction-timeout attribute to the screen  
> element in the screen def XML files. Just specify the number of  seconds
> for the timeout there. You can also use the  FlexibleStringExpander
> syntax in it (ie ${whatever}).
>
> Enjoy...
>
> -David
>
>
> On Nov 13, 2005, at 5:59 AM, Jacopo Cappellato wrote:
>
>> Hi Christopher,
>>
>> I too have noticed something similar and I'd like to help you find  
>> what is causing this problem.
>> First of all:
>>
>> the value that you set in the TRANSACTION_TIMEOUT parameter is used  
>> in the following class:
>>
>> framework\widget\src\org\ofbiz\widget\screen\ModelScreen.java
>>
>> in the method "renderScreenString" (line 120)
>>
>> Could you try to add a few debug statements in that class to see if  
>> the parameter is correctly used?
>> Also, you could test the value of the "beganTransaction" boolean  
>> variable returned in line 120:
>>
>> beganTransaction = TransactionUtil.begin(transactionTimeout);
>>
>> If it is false, this means that the transaction has been already  
>> started (with a different transaction timeout?) in a different  
>> place... if this is the case, maybe the transaction timeout set in  
>> line 120 is ignored?
>>
>> Hope this helps,
>>
>> Jacopo
>>
>>
>> Christopher Farley wrote:
>>
>>> I've been having problems with transactions timing out. I first  
>>> noticed this when trying to import large XML files. I am now  trying
>>> to create a screen widget that calls a script that can take  a while
>>> to execute. I am
>>> getting what I believe to be transaction timeout errors.
>>> The not-too-helpful error message returned to the UI is: [problem  
>>> creating the newEntity value: SQL Exception occurred on commit  
>>> (Cannot commit a transactional connection: See JDBC 2.0 Optional  
>>> Package Specification section 7.1 (p25))]
>>> This happens after about 65-70 seconds consistently. If I break  the
>>> task
>>> down to smaller data sets that execute faster than this,  everything
>>> works
>>> as expected, so I'm pretty sure I am not feeding corrupt data.
>>> To set the TRANSACTION_TIMEOUT in a screen, I have been doing  something
>>> like this:
>>> <screen name="Whatever">
>>>     <actions>
>>>         <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/>
>>>     </actions>
>>>     ....
>>> </screen>
>>> This seems to have no effect. I added a debug statement to the  
>>> TransactionUtil class, and the begin() method is always being called
>>> with a value of "0". Is this the proper way to change the  
>>> transaction timeout? Is there something
>>> else that might be timing out? Thanks for any help you can give...
>>
>>
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
>

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users