You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacopo Cappellato <ti...@sastau.it> on 2007/12/11 16:13:23 UTC

Transaction related error in log when the

The following error is logged (even if the service works as expected) 
when the service "getInventoryAvailableByFacility" is called:

======================================================================
2007-12-11 15:54:57,906 (default-invoker-Thread-6) [ 
GenericDelegator.java:2031:ERROR] ---- exception report 
---------------------------------------------------------- ERROR: Cannot 
do a find that returns an EntityListIterator with no transaction in 
place. Wrap this call in a transaction. Exception: java.lang.Exception 
Message: Stack Trace ---- stack trace 
--------------------------------------------------------------- 
java.lang.Exception: Stack Trace 
org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:2030) 
org.ofbiz.entity.GenericDelegator.findListIteratorByCondition(GenericDelegator.java:2008) 
org.ofbiz.minilang.method.entityops.FindByAnd.exec(FindByAnd.java:88) 
org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:931) 
org.ofbiz.minilang.method.ifops.IfCompare.exec(IfCompare.java:121) 
org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:931) 
org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:568) 
org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:105) 
org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:87) 
org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76) 
org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java:51) 
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:375) 
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:208) 
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)

======================================================================

I think this is caused by the service definition that has:

use-transaction="false"

I've noticed that this flag has been set by Si in rev. r438286:

"Turned off transactions for all the getInventory_ services -- they do 
not store anything and should not require them.  Also added marketing 
package ATP/QOH to the getProductInventorySummaryForItems service which 
searches across all facilities"

Is there a reason for setting this flag? Should we remove it? Or is the 
error a fake error that should be fixed instead?

Jacopo


Re: Transaction related error in log when the

Posted by Jonathon -- Improov <jo...@improov.com>.
Hi Jacopo,

Just chiming in.

David is absolutely right.

Transactions are always needed. For database reads, transactions are needed to prevent dirty 
reads, for example. It should be obvious why update, delete, insert need transactions.

The use-transaction=false should only be off when the service does it's own transaction 
management. Especially when a separate transaction outside of current transaction is needed -- 
such as when wanting to update a log regardless of how current transaction proceeds.

But be careful of forking transactions like that. Must make sure the forked transaction only 
handles data that is not related to the data handled by the main transaction. I had a recent 
project where we went into a "fork frenzy", forking more and more transactions to escape deadlocks.

Check that particular service to see if it does any transaction management of its own. I'll check 
too, and report.

Jonathon

Jacopo Cappellato wrote:
> Of course,
> 
> I'd love too to get Si's opinion... but I have the feeling he doesn't 
> like to participate in ML discussions. In the last months I don't 
> remember a message from Si, apart from the comments on Jira and the 
> commit logs.
> Hopefully he will find a moment to jump in this discussion, if not, I 
> can try to open a Jira issue to capture Si's attention (I'm joking, Si)
> 
> Jacopo
> 
> 
> David E Jones wrote:
>>
>> It would be good to hear Si's comment on that, but my vote is 
>> definitely for removing it.
>>
>> A service should only really have use-transaction set to false if it 
>> is doing it's own transaction management internally, like manually or 
>> in sub-services only.
>>
>> -David
>>
> 
> 


Re: Transaction related error in log when the

Posted by Jacopo Cappellato <ti...@sastau.it>.
Of course,

I'd love too to get Si's opinion... but I have the feeling he doesn't 
like to participate in ML discussions. In the last months I don't 
remember a message from Si, apart from the comments on Jira and the 
commit logs.
Hopefully he will find a moment to jump in this discussion, if not, I 
can try to open a Jira issue to capture Si's attention (I'm joking, Si)

Jacopo


David E Jones wrote:
> 
> It would be good to hear Si's comment on that, but my vote is definitely 
> for removing it.
> 
> A service should only really have use-transaction set to false if it is 
> doing it's own transaction management internally, like manually or in 
> sub-services only.
> 
> -David
> 

Re: Transaction related error in log when the

Posted by David E Jones <jo...@hotwaxmedia.com>.
It would be good to hear Si's comment on that, but my vote is  
definitely for removing it.

A service should only really have use-transaction set to false if it  
is doing it's own transaction management internally, like manually or  
in sub-services only.

-David


On Dec 11, 2007, at 11:00 AM, Jacopo Cappellato wrote:

> David,
>
> thanks for the explanation.
>
> So I guess that it is ok to remove the use-transaction="false" for  
> these services, right?
>
> Jacopo
>
> David E Jones wrote:
>> This is an important error message. The problem is that the Entity  
>> Engine can't just create a transaction for these because it can't  
>> commit or rollback the transaction because the connection and  
>> ResultSet stay open until the EntityListIterator is closed, which  
>> is done by the code calling the EE and so the transaction must be  
>> managed outside the EE.
>> It is not correct that read only operations don't need a  
>> transaction. Part of the definition of transaction isolation  
>> definitely involves reading as well as writing.
>> -David
>> On Dec 11, 2007, at 8:13 AM, Jacopo Cappellato wrote:
>>> The following error is logged (even if the service works as  
>>> expected) when the service "getInventoryAvailableByFacility" is  
>>> called:
>>>
>>> = 
>>> = 
>>> ====================================================================
>>> 2007-12-11 15:54:57,906 (default-invoker-Thread-6)  
>>> [ GenericDelegator.java:2031:ERROR] ---- exception report  
>>> ---------------------------------------------------------- ERROR:  
>>> Cannot do a find that returns an EntityListIterator with no  
>>> transaction in place. Wrap this call in a transaction. Exception:  
>>> java.lang.Exception Message: Stack Trace ---- stack trace  
>>> ---------------------------------------------------------------  
>>> java.lang.Exception: Stack Trace  
>>> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:2030)  
>>> org 
>>> .ofbiz 
>>> .entity 
>>> .GenericDelegator 
>>> .findListIteratorByCondition(GenericDelegator.java:2008)  
>>> org.ofbiz.minilang.method.entityops.FindByAnd.exec(FindByAnd.java: 
>>> 88) org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java: 
>>> 931) org.ofbiz.minilang.method.ifops.IfCompare.exec(IfCompare.java: 
>>> 121) org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java: 
>>> 931) org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:568)  
>>> org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java: 
>>> 105)  
>>> org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java: 
>>> 87)  
>>> org 
>>> .ofbiz 
>>> .minilang 
>>> .SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76)  
>>> org 
>>> .ofbiz 
>>> .minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java:51)  
>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java: 
>>> 375)  
>>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java: 
>>> 208)  
>>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java: 
>>> 136)
>>>
>>> = 
>>> = 
>>> ====================================================================
>>>
>>> I think this is caused by the service definition that has:
>>>
>>> use-transaction="false"
>>>
>>> I've noticed that this flag has been set by Si in rev. r438286:
>>>
>>> "Turned off transactions for all the getInventory_ services --  
>>> they do not store anything and should not require them.  Also  
>>> added marketing package ATP/QOH to the  
>>> getProductInventorySummaryForItems service which searches across  
>>> all facilities"
>>>
>>> Is there a reason for setting this flag? Should we remove it? Or  
>>> is the error a fake error that should be fixed instead?
>>>
>>> Jacopo
>>>
>


Re: Transaction related error in log when the

Posted by Jacopo Cappellato <ti...@sastau.it>.
David,

thanks for the explanation.

So I guess that it is ok to remove the use-transaction="false" for these 
services, right?

Jacopo

David E Jones wrote:
> 
> This is an important error message. The problem is that the Entity 
> Engine can't just create a transaction for these because it can't commit 
> or rollback the transaction because the connection and ResultSet stay 
> open until the EntityListIterator is closed, which is done by the code 
> calling the EE and so the transaction must be managed outside the EE.
> 
> It is not correct that read only operations don't need a transaction. 
> Part of the definition of transaction isolation definitely involves 
> reading as well as writing.
> 
> -David
> 
> 
> On Dec 11, 2007, at 8:13 AM, Jacopo Cappellato wrote:
> 
>> The following error is logged (even if the service works as expected) 
>> when the service "getInventoryAvailableByFacility" is called:
>>
>> ======================================================================
>> 2007-12-11 15:54:57,906 (default-invoker-Thread-6) [ 
>> GenericDelegator.java:2031:ERROR] ---- exception report 
>> ---------------------------------------------------------- ERROR: 
>> Cannot do a find that returns an EntityListIterator with no 
>> transaction in place. Wrap this call in a transaction. Exception: 
>> java.lang.Exception Message: Stack Trace ---- stack trace 
>> --------------------------------------------------------------- 
>> java.lang.Exception: Stack Trace 
>> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:2030) 
>> org.ofbiz.entity.GenericDelegator.findListIteratorByCondition(GenericDelegator.java:2008) 
>> org.ofbiz.minilang.method.entityops.FindByAnd.exec(FindByAnd.java:88) 
>> org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:931) 
>> org.ofbiz.minilang.method.ifops.IfCompare.exec(IfCompare.java:121) 
>> org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:931) 
>> org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:568) 
>> org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:105) 
>> org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:87) 
>> org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76) 
>> org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java:51) 
>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:375) 
>> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:208) 
>> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
>>
>> ======================================================================
>>
>> I think this is caused by the service definition that has:
>>
>> use-transaction="false"
>>
>> I've noticed that this flag has been set by Si in rev. r438286:
>>
>> "Turned off transactions for all the getInventory_ services -- they do 
>> not store anything and should not require them.  Also added marketing 
>> package ATP/QOH to the getProductInventorySummaryForItems service 
>> which searches across all facilities"
>>
>> Is there a reason for setting this flag? Should we remove it? Or is 
>> the error a fake error that should be fixed instead?
>>
>> Jacopo
>>
> 


Re: Transaction related error in log when the

Posted by David E Jones <jo...@hotwaxmedia.com>.
This is an important error message. The problem is that the Entity  
Engine can't just create a transaction for these because it can't  
commit or rollback the transaction because the connection and  
ResultSet stay open until the EntityListIterator is closed, which is  
done by the code calling the EE and so the transaction must be managed  
outside the EE.

It is not correct that read only operations don't need a transaction.  
Part of the definition of transaction isolation definitely involves  
reading as well as writing.

-David


On Dec 11, 2007, at 8:13 AM, Jacopo Cappellato wrote:

> The following error is logged (even if the service works as  
> expected) when the service "getInventoryAvailableByFacility" is  
> called:
>
> ======================================================================
> 2007-12-11 15:54:57,906 (default-invoker-Thread-6)  
> [ GenericDelegator.java:2031:ERROR] ---- exception report  
> ---------------------------------------------------------- ERROR:  
> Cannot do a find that returns an EntityListIterator with no  
> transaction in place. Wrap this call in a transaction. Exception:  
> java.lang.Exception Message: Stack Trace ---- stack trace  
> ---------------------------------------------------------------  
> java.lang.Exception: Stack Trace  
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:2030)  
> org 
> .ofbiz 
> .entity 
> .GenericDelegator.findListIteratorByCondition(GenericDelegator.java: 
> 2008)  
> org.ofbiz.minilang.method.entityops.FindByAnd.exec(FindByAnd.java: 
> 88) org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:931)  
> org.ofbiz.minilang.method.ifops.IfCompare.exec(IfCompare.java:121)  
> org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:931)  
> org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:568)  
> org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java: 
> 105)  
> org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java: 
> 87)  
> org 
> .ofbiz 
> .minilang 
> .SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76)  
> org 
> .ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java: 
> 51)  
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java: 
> 375)  
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java: 
> 208)  
> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java: 
> 136)
>
> ======================================================================
>
> I think this is caused by the service definition that has:
>
> use-transaction="false"
>
> I've noticed that this flag has been set by Si in rev. r438286:
>
> "Turned off transactions for all the getInventory_ services -- they  
> do not store anything and should not require them.  Also added  
> marketing package ATP/QOH to the getProductInventorySummaryForItems  
> service which searches across all facilities"
>
> Is there a reason for setting this flag? Should we remove it? Or is  
> the error a fake error that should be fixed instead?
>
> Jacopo
>