You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Imesh Gunaratne <im...@apache.org> on 2015/01/31 19:36:36 UTC

[Discuss] [Issue] Topology Locks Are Not Created On Demand

Hi Devs,

I see an issue with topology hierarchy locking behaviour. The problem is
that topology lock objects are created at the time services and clusters
are created. IMO this is error prone, now with the latest codebase I can
see error logs saying "topology lock not found". Ideally locks should
always be created on demand.

Thanks


-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [Discuss] [Issue] Topology Locks Are Not Created On Demand

Posted by Imesh Gunaratne <im...@apache.org>.
Hi Isuru,

Thanks for your feedback, yes what you have pointed out is correct. However
IMO locks are only there for synchronizing logic against multiple threads.
There are not used for validating logic:

try {
   acquireLock();
   validateInputs();
   executeLogic();
finally {
   releaseLock();
}

Therefore I think if there is a functional issue it should be detected by
validations.

Thanks

On Sun, Feb 1, 2015 at 9:52 AM, Isuru Haththotuwa <is...@apache.org> wrote:

> Hi Imesh,
>
> On Sun, Feb 1, 2015 at 9:08 AM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> Hi Isuru,
>>
>> Let me re-clarify the above point again, IMO when a block of code is
>> trying to acquire a lock, the lock acquiring process should not fail due to
>> any reason. The best way to do this is to create lock objects on demand.
>> Lock object removal process works as it was before, when removing services
>> and clusters from the topology.
>>
> If a lock has been previously removed and then a same lock is getting is
> being accessed again, IMO its a bug in the code. If we create locks on
> demand, we this issue will get ignored. IMHO we can create the lock in the
> constructor itself as it was done previously. Then we are sure that the
> lock is there, unless it has been removed due to a problem in the logic,
> which we should fix. This was the thinking previously.
>
>>
>> I have now fixed this issue as described above with following commit
>> revision:
>> 35269223d9bc93279b6a5ebec124aa57695152e3
>>
>
>> Thanks
>>
>> On Sun, Feb 1, 2015 at 8:58 AM, Imesh Gunaratne <im...@apache.org> wrote:
>>
>>> Hi Isuru,
>>>
>>> With the latest codebase we can see how it has affected, now due to some
>>> reason lock objects are not getting created. As a result the lock acquire
>>> calls fail.
>>>
>>> IMO we need to create lock objects on demand and remove them when
>>> relevant topology objects get removed from the system.
>>>
>>> Thanks
>>>
>>> On Sun, Feb 1, 2015 at 8:20 AM, Isuru Haththotuwa <is...@apache.org>
>>> wrote:
>>>
>>>> Hi Imesh,
>>>>
>>>> On Sun, Feb 1, 2015 at 12:06 AM, Imesh Gunaratne <im...@apache.org>
>>>> wrote:
>>>>
>>>>> Hi Devs,
>>>>>
>>>>> I see an issue with topology hierarchy locking behaviour. The problem
>>>>> is that topology lock objects are created at the time services and clusters
>>>>> are created. IMO this is error prone, now with the latest codebase I can
>>>>> see error logs saying "topology lock not found". Ideally locks should
>>>>> always be created on demand.
>>>>>
>>>>  Can you explain a bit more about how this behavior is error prone? The
>>>> logic was that each time a cluster/service/app is added/removed, we should
>>>> be creating/removing the relevant lock(s). If that is not correctly
>>>> happening we need to check where that is not happening and fix it.
>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>> --
>>>>> Imesh Gunaratne
>>>>>
>>>>> Technical Lead, WSO2
>>>>> Committer & PMC Member, Apache Stratos
>>>>>
>>>>> --
>>>>> Thanks and Regards,
>>>>>
>>>>> Isuru H.
>>>>> +94 716 358 048* <http://wso2.com/>*
>>>>>
>>>>>
>>>>> * <http://wso2.com/>*
>>>>>
>>>>>
>>>>>
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>> --
>> Thanks and Regards,
>>
>> Isuru H.
>> +94 716 358 048* <http://wso2.com/>*
>>
>>
>> * <http://wso2.com/>*
>>
>>
>>


-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [Discuss] [Issue] Topology Locks Are Not Created On Demand

Posted by Isuru Haththotuwa <is...@apache.org>.
Hi Imesh,

On Sun, Feb 1, 2015 at 9:08 AM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Isuru,
>
> Let me re-clarify the above point again, IMO when a block of code is
> trying to acquire a lock, the lock acquiring process should not fail due to
> any reason. The best way to do this is to create lock objects on demand.
> Lock object removal process works as it was before, when removing services
> and clusters from the topology.
>
If a lock has been previously removed and then a same lock is getting is
being accessed again, IMO its a bug in the code. If we create locks on
demand, we this issue will get ignored. IMHO we can create the lock in the
constructor itself as it was done previously. Then we are sure that the
lock is there, unless it has been removed due to a problem in the logic,
which we should fix. This was the thinking previously.

>
> I have now fixed this issue as described above with following commit
> revision:
> 35269223d9bc93279b6a5ebec124aa57695152e3
>

> Thanks
>
> On Sun, Feb 1, 2015 at 8:58 AM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> Hi Isuru,
>>
>> With the latest codebase we can see how it has affected, now due to some
>> reason lock objects are not getting created. As a result the lock acquire
>> calls fail.
>>
>> IMO we need to create lock objects on demand and remove them when
>> relevant topology objects get removed from the system.
>>
>> Thanks
>>
>> On Sun, Feb 1, 2015 at 8:20 AM, Isuru Haththotuwa <is...@apache.org>
>> wrote:
>>
>>> Hi Imesh,
>>>
>>> On Sun, Feb 1, 2015 at 12:06 AM, Imesh Gunaratne <im...@apache.org>
>>> wrote:
>>>
>>>> Hi Devs,
>>>>
>>>> I see an issue with topology hierarchy locking behaviour. The problem
>>>> is that topology lock objects are created at the time services and clusters
>>>> are created. IMO this is error prone, now with the latest codebase I can
>>>> see error logs saying "topology lock not found". Ideally locks should
>>>> always be created on demand.
>>>>
>>>  Can you explain a bit more about how this behavior is error prone? The
>>> logic was that each time a cluster/service/app is added/removed, we should
>>> be creating/removing the relevant lock(s). If that is not correctly
>>> happening we need to check where that is not happening and fix it.
>>>
>>>>
>>>> Thanks
>>>>
>>>>
>>>> --
>>>> Imesh Gunaratne
>>>>
>>>> Technical Lead, WSO2
>>>> Committer & PMC Member, Apache Stratos
>>>>
>>>> --
>>>> Thanks and Regards,
>>>>
>>>> Isuru H.
>>>> +94 716 358 048* <http://wso2.com/>*
>>>>
>>>>
>>>> * <http://wso2.com/>*
>>>>
>>>>
>>>>
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048* <http://wso2.com/>*
>
>
> * <http://wso2.com/>*
>
>
>

Re: [Discuss] [Issue] Topology Locks Are Not Created On Demand

Posted by Imesh Gunaratne <im...@apache.org>.
Hi Isuru,

Let me re-clarify the above point again, IMO when a block of code is trying
to acquire a lock, the lock acquiring process should not fail due to any
reason. The best way to do this is to create lock objects on demand. Lock
object removal process works as it was before, when removing services and
clusters from the topology.

I have now fixed this issue as described above with following commit
revision:
35269223d9bc93279b6a5ebec124aa57695152e3

Thanks

On Sun, Feb 1, 2015 at 8:58 AM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Isuru,
>
> With the latest codebase we can see how it has affected, now due to some
> reason lock objects are not getting created. As a result the lock acquire
> calls fail.
>
> IMO we need to create lock objects on demand and remove them when relevant
> topology objects get removed from the system.
>
> Thanks
>
> On Sun, Feb 1, 2015 at 8:20 AM, Isuru Haththotuwa <is...@apache.org>
> wrote:
>
>> Hi Imesh,
>>
>> On Sun, Feb 1, 2015 at 12:06 AM, Imesh Gunaratne <im...@apache.org>
>> wrote:
>>
>>> Hi Devs,
>>>
>>> I see an issue with topology hierarchy locking behaviour. The problem is
>>> that topology lock objects are created at the time services and clusters
>>> are created. IMO this is error prone, now with the latest codebase I can
>>> see error logs saying "topology lock not found". Ideally locks should
>>> always be created on demand.
>>>
>>  Can you explain a bit more about how this behavior is error prone? The
>> logic was that each time a cluster/service/app is added/removed, we should
>> be creating/removing the relevant lock(s). If that is not correctly
>> happening we need to check where that is not happening and fix it.
>>
>>>
>>> Thanks
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>> --
>>> Thanks and Regards,
>>>
>>> Isuru H.
>>> +94 716 358 048* <http://wso2.com/>*
>>>
>>>
>>> * <http://wso2.com/>*
>>>
>>>
>>>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>



-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [Discuss] [Issue] Topology Locks Are Not Created On Demand

Posted by Imesh Gunaratne <im...@apache.org>.
Hi Isuru,

With the latest codebase we can see how it has affected, now due to some
reason lock objects are not getting created. As a result the lock acquire
calls fail.

IMO we need to create lock objects on demand and remove them when relevant
topology objects get removed from the system.

Thanks

On Sun, Feb 1, 2015 at 8:20 AM, Isuru Haththotuwa <is...@apache.org> wrote:

> Hi Imesh,
>
> On Sun, Feb 1, 2015 at 12:06 AM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> Hi Devs,
>>
>> I see an issue with topology hierarchy locking behaviour. The problem is
>> that topology lock objects are created at the time services and clusters
>> are created. IMO this is error prone, now with the latest codebase I can
>> see error logs saying "topology lock not found". Ideally locks should
>> always be created on demand.
>>
>  Can you explain a bit more about how this behavior is error prone? The
> logic was that each time a cluster/service/app is added/removed, we should
> be creating/removing the relevant lock(s). If that is not correctly
> happening we need to check where that is not happening and fix it.
>
>>
>> Thanks
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>> --
>> Thanks and Regards,
>>
>> Isuru H.
>> +94 716 358 048* <http://wso2.com/>*
>>
>>
>> * <http://wso2.com/>*
>>
>>
>>


-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [Discuss] [Issue] Topology Locks Are Not Created On Demand

Posted by Isuru Haththotuwa <is...@apache.org>.
Hi Imesh,

On Sun, Feb 1, 2015 at 12:06 AM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Devs,
>
> I see an issue with topology hierarchy locking behaviour. The problem is
> that topology lock objects are created at the time services and clusters
> are created. IMO this is error prone, now with the latest codebase I can
> see error logs saying "topology lock not found". Ideally locks should
> always be created on demand.
>
 Can you explain a bit more about how this behavior is error prone? The
logic was that each time a cluster/service/app is added/removed, we should
be creating/removing the relevant lock(s). If that is not correctly
happening we need to check where that is not happening and fix it.

>
> Thanks
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048* <http://wso2.com/>*
>
>
> * <http://wso2.com/>*
>
>
>