You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <jl...@apache.org> on 2017/08/12 08:23:50 UTC

Re: Permission service not on the same transaction

Hi Nicolas,

Just stumbled upon this. Is there a Jira? What is the revision commit number?

Thanks
Jacques (sent from PonyMail)

On 2016-04-14 21:03, Nicolas Malin <ni...@nereide.fr> wrote: 
> No remarks on this case ?
> 
> If the silent is present I open an issue and commit this patch ;)
> 
> Nicolas
> 
> Le 07/04/2016 10:00, Nicolas Malin a écrit :
> > Hello,
> >
> > Currently I continue the conversion on shipment  crud service and I 
> > detected that many service use the same mini-lang call to check if the 
> > shipment status is ok for editing "checkCanChangeShipmentStatusPacked"
> >
> > I convert it on service to call it directly by the permission-service 
> > like that :
> >
> >     <service name="createShipmentPackageContent" 
> > default-entity-name="ShipmentPackageContent" engine="entity-auto" 
> > invoke="create" auth="true">...
> >         <permission-service 
> > service-name="checkCanChangeShipmentStatusPacked" main-action="CREATE"/>
> >         <auto-attributes include="pk" mode="IN" optional="false"/>...
> >     </service>
> >
> > The problem with this change that when I run the unit tests, I have 
> > some failed to due database lock on shipment.
> > After some analyse I founded that the permission service wasn't call 
> > on the same service's transaction.
> > I a realize this change :
> >
> > Index: framework/service/src/org/ofbiz/service/ModelService.java
> > ===================================================================
> > --- framework/service/src/org/ofbiz/service/ModelService.java 
> > (révision 1737860)
> > +++ framework/service/src/org/ofbiz/service/ModelService.java (copie 
> > de travail)
> > @@ -985,7 +985,7 @@
> >                  LocalDispatcher dispatcher = dctx.getDispatcher();
> >                  Map<String, Object> resp;
> >                  try {
> > -                    resp = dispatcher.runSync(permission.name, ctx, 
> > 300, true);
> > +                    resp = dispatcher.runSync(permission.name, ctx);
> >                  } catch (GenericServiceException e) {
> >                      Debug.logError(e, module);
> >                      Map<String, Object> result = 
> > ServiceUtil.returnSuccess();
> >
> > All unit test pass.
> > Anyone know the reason to call the permission service on a new 
> > transaction ?
> > I couldn't spot any valid reason.
> >
> > Thnaks for help ;)
> >
> > Nicolas
> >
> > -- 
> > #jeSuisCharlie
> > logoNrd <http://nereide.fr/>
> > 	Nicolas Malin
> > Ingénieur d'étude. Dernier sujet : "Les vaches portant un prénom 
> > pouvent trouver la sortie d'un labyrinthe en cas de toxoplasmose
> > information@nereide.fr
> > 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
> >
> > Apache OFBiz <http://ofbiz.apache.org/> | ofbiz-fr 
> > <http://www.ofbiz-fr.org/> | | réseau LE 
> > <http://www.libre-entreprise.org/>
> 
> 

Re: Permission service not on the same transaction

Posted by Nicolas Malin <ni...@nereide.fr>.
No worries, I agree we can wait after de 17 to improve this part

Nicolas


Le 14/12/2017 à 23:22, Jacques Le Roux a écrit :
> Thanks Nicolas,
>
> Sorry, I completely forgot about that.
>
> I'll have a look ASAP, but after 
> https://issues.apache.org/jira/browse/OFBIZ-10047 that I want in R17 :)
>
> Jacques
>
> Le 14/08/2017 à 20:40, Nicolas Malin a écrit :
>> Hi Jacques,
>>
>> All is present on the issue OFBIZ-7113 
>> <https://issues.apache.org/jira/browse/OFBIZ-7113>
>>
>> But I think the patch doesn't up to date.
>> It contains big change, I will review quietly if you think it would 
>> be a good improvement
>>
>> Nicolas
>> Le 12/08/2017 à 10:23, Jacques Le Roux a écrit :
>>> Hi Nicolas,
>>>
>>> Just stumbled upon this. Is there a Jira? What is the revision 
>>> commit number?
>>>
>>> Thanks
>>> Jacques (sent from PonyMail)
>>>
>>> On 2016-04-14 21:03, Nicolas Malin <ni...@nereide.fr> wrote:
>>>> No remarks on this case ?
>>>>
>>>> If the silent is present I open an issue and commit this patch ;)
>>>>
>>>> Nicolas
>>>>
>>>> Le 07/04/2016 10:00, Nicolas Malin a écrit :
>>>>> Hello,
>>>>>
>>>>> Currently I continue the conversion on shipment  crud service and I
>>>>> detected that many service use the same mini-lang call to check if 
>>>>> the
>>>>> shipment status is ok for editing 
>>>>> "checkCanChangeShipmentStatusPacked"
>>>>>
>>>>> I convert it on service to call it directly by the permission-service
>>>>> like that :
>>>>>
>>>>>      <service name="createShipmentPackageContent"
>>>>> default-entity-name="ShipmentPackageContent" engine="entity-auto"
>>>>> invoke="create" auth="true">...
>>>>>          <permission-service
>>>>> service-name="checkCanChangeShipmentStatusPacked" 
>>>>> main-action="CREATE"/>
>>>>>          <auto-attributes include="pk" mode="IN" 
>>>>> optional="false"/>...
>>>>>      </service>
>>>>>
>>>>> The problem with this change that when I run the unit tests, I have
>>>>> some failed to due database lock on shipment.
>>>>> After some analyse I founded that the permission service wasn't call
>>>>> on the same service's transaction.
>>>>> I a realize this change :
>>>>>
>>>>> Index: framework/service/src/org/ofbiz/service/ModelService.java
>>>>> ===================================================================
>>>>> --- framework/service/src/org/ofbiz/service/ModelService.java
>>>>> (révision 1737860)
>>>>> +++ framework/service/src/org/ofbiz/service/ModelService.java (copie
>>>>> de travail)
>>>>> @@ -985,7 +985,7 @@
>>>>>                   LocalDispatcher dispatcher = dctx.getDispatcher();
>>>>>                   Map<String, Object> resp;
>>>>>                   try {
>>>>> -                    resp = dispatcher.runSync(permission.name, ctx,
>>>>> 300, true);
>>>>> +                    resp = dispatcher.runSync(permission.name, ctx);
>>>>>                   } catch (GenericServiceException e) {
>>>>>                       Debug.logError(e, module);
>>>>>                       Map<String, Object> result =
>>>>> ServiceUtil.returnSuccess();
>>>>>
>>>>> All unit test pass.
>>>>> Anyone know the reason to call the permission service on a new
>>>>> transaction ?
>>>>> I couldn't spot any valid reason.
>>>>>
>>>>> Thnaks for help ;)
>>>>>
>>>>> Nicolas
>>>>>
>>>>> -- 
>>>>> #jeSuisCharlie
>>>>> logoNrd <http://nereide.fr/>
>>>>>     Nicolas Malin
>>>>> Ingénieur d'étude. Dernier sujet : "Les vaches portant un prénom
>>>>> pouvent trouver la sortie d'un labyrinthe en cas de toxoplasmose
>>>>> information@nereide.fr
>>>>> 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>>>>>
>>>>> Apache OFBiz <http://ofbiz.apache.org/> | ofbiz-fr
>>>>> <http://www.ofbiz-fr.org/> | | réseau LE
>>>>> <http://www.libre-entreprise.org/>
>>>>
>>
>>
>
>


Re: Permission service not on the same transaction

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Nicolas,

Sorry, I completely forgot about that.

I'll have a look ASAP, but after https://issues.apache.org/jira/browse/OFBIZ-10047 that I want in R17 :)

Jacques

Le 14/08/2017 à 20:40, Nicolas Malin a écrit :
> Hi Jacques,
>
> All is present on the issue OFBIZ-7113 <https://issues.apache.org/jira/browse/OFBIZ-7113>
>
> But I think the patch doesn't up to date.
> It contains big change, I will review quietly if you think it would be a good improvement
>
> Nicolas
> Le 12/08/2017 à 10:23, Jacques Le Roux a écrit :
>> Hi Nicolas,
>>
>> Just stumbled upon this. Is there a Jira? What is the revision commit number?
>>
>> Thanks
>> Jacques (sent from PonyMail)
>>
>> On 2016-04-14 21:03, Nicolas Malin <ni...@nereide.fr> wrote:
>>> No remarks on this case ?
>>>
>>> If the silent is present I open an issue and commit this patch ;)
>>>
>>> Nicolas
>>>
>>> Le 07/04/2016 10:00, Nicolas Malin a écrit :
>>>> Hello,
>>>>
>>>> Currently I continue the conversion on shipment  crud service and I
>>>> detected that many service use the same mini-lang call to check if the
>>>> shipment status is ok for editing "checkCanChangeShipmentStatusPacked"
>>>>
>>>> I convert it on service to call it directly by the permission-service
>>>> like that :
>>>>
>>>>      <service name="createShipmentPackageContent"
>>>> default-entity-name="ShipmentPackageContent" engine="entity-auto"
>>>> invoke="create" auth="true">...
>>>>          <permission-service
>>>> service-name="checkCanChangeShipmentStatusPacked" main-action="CREATE"/>
>>>>          <auto-attributes include="pk" mode="IN" optional="false"/>...
>>>>      </service>
>>>>
>>>> The problem with this change that when I run the unit tests, I have
>>>> some failed to due database lock on shipment.
>>>> After some analyse I founded that the permission service wasn't call
>>>> on the same service's transaction.
>>>> I a realize this change :
>>>>
>>>> Index: framework/service/src/org/ofbiz/service/ModelService.java
>>>> ===================================================================
>>>> --- framework/service/src/org/ofbiz/service/ModelService.java
>>>> (révision 1737860)
>>>> +++ framework/service/src/org/ofbiz/service/ModelService.java (copie
>>>> de travail)
>>>> @@ -985,7 +985,7 @@
>>>>                   LocalDispatcher dispatcher = dctx.getDispatcher();
>>>>                   Map<String, Object> resp;
>>>>                   try {
>>>> -                    resp = dispatcher.runSync(permission.name, ctx,
>>>> 300, true);
>>>> +                    resp = dispatcher.runSync(permission.name, ctx);
>>>>                   } catch (GenericServiceException e) {
>>>>                       Debug.logError(e, module);
>>>>                       Map<String, Object> result =
>>>> ServiceUtil.returnSuccess();
>>>>
>>>> All unit test pass.
>>>> Anyone know the reason to call the permission service on a new
>>>> transaction ?
>>>> I couldn't spot any valid reason.
>>>>
>>>> Thnaks for help ;)
>>>>
>>>> Nicolas
>>>>
>>>> -- 
>>>> #jeSuisCharlie
>>>> logoNrd <http://nereide.fr/>
>>>>     Nicolas Malin
>>>> Ingénieur d'étude. Dernier sujet : "Les vaches portant un prénom
>>>> pouvent trouver la sortie d'un labyrinthe en cas de toxoplasmose
>>>> information@nereide.fr
>>>> 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>>>>
>>>> Apache OFBiz <http://ofbiz.apache.org/> | ofbiz-fr
>>>> <http://www.ofbiz-fr.org/> | | réseau LE
>>>> <http://www.libre-entreprise.org/>
>>>
>
>


Re: Permission service not on the same transaction

Posted by Nicolas Malin <ni...@nereide.fr>.
Hi Jacques,

All is present on the issue OFBIZ-7113 
<https://issues.apache.org/jira/browse/OFBIZ-7113>

But I think the patch doesn't up to date.
It contains big change, I will review quietly if you think it would be a 
good improvement

Nicolas
Le 12/08/2017 à 10:23, Jacques Le Roux a écrit :
> Hi Nicolas,
>
> Just stumbled upon this. Is there a Jira? What is the revision commit number?
>
> Thanks
> Jacques (sent from PonyMail)
>
> On 2016-04-14 21:03, Nicolas Malin <ni...@nereide.fr> wrote:
>> No remarks on this case ?
>>
>> If the silent is present I open an issue and commit this patch ;)
>>
>> Nicolas
>>
>> Le 07/04/2016 10:00, Nicolas Malin a écrit :
>>> Hello,
>>>
>>> Currently I continue the conversion on shipment  crud service and I
>>> detected that many service use the same mini-lang call to check if the
>>> shipment status is ok for editing "checkCanChangeShipmentStatusPacked"
>>>
>>> I convert it on service to call it directly by the permission-service
>>> like that :
>>>
>>>      <service name="createShipmentPackageContent"
>>> default-entity-name="ShipmentPackageContent" engine="entity-auto"
>>> invoke="create" auth="true">...
>>>          <permission-service
>>> service-name="checkCanChangeShipmentStatusPacked" main-action="CREATE"/>
>>>          <auto-attributes include="pk" mode="IN" optional="false"/>...
>>>      </service>
>>>
>>> The problem with this change that when I run the unit tests, I have
>>> some failed to due database lock on shipment.
>>> After some analyse I founded that the permission service wasn't call
>>> on the same service's transaction.
>>> I a realize this change :
>>>
>>> Index: framework/service/src/org/ofbiz/service/ModelService.java
>>> ===================================================================
>>> --- framework/service/src/org/ofbiz/service/ModelService.java
>>> (révision 1737860)
>>> +++ framework/service/src/org/ofbiz/service/ModelService.java (copie
>>> de travail)
>>> @@ -985,7 +985,7 @@
>>>                   LocalDispatcher dispatcher = dctx.getDispatcher();
>>>                   Map<String, Object> resp;
>>>                   try {
>>> -                    resp = dispatcher.runSync(permission.name, ctx,
>>> 300, true);
>>> +                    resp = dispatcher.runSync(permission.name, ctx);
>>>                   } catch (GenericServiceException e) {
>>>                       Debug.logError(e, module);
>>>                       Map<String, Object> result =
>>> ServiceUtil.returnSuccess();
>>>
>>> All unit test pass.
>>> Anyone know the reason to call the permission service on a new
>>> transaction ?
>>> I couldn't spot any valid reason.
>>>
>>> Thnaks for help ;)
>>>
>>> Nicolas
>>>
>>> -- 
>>> #jeSuisCharlie
>>> logoNrd <http://nereide.fr/>
>>> 	Nicolas Malin
>>> Ingénieur d'étude. Dernier sujet : "Les vaches portant un prénom
>>> pouvent trouver la sortie d'un labyrinthe en cas de toxoplasmose
>>> information@nereide.fr
>>> 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>>>
>>> Apache OFBiz <http://ofbiz.apache.org/> | ofbiz-fr
>>> <http://www.ofbiz-fr.org/> | | réseau LE
>>> <http://www.libre-entreprise.org/>
>>