[Home]

Summary:ASTERISK-16868: [patch] Function LOCK doesn't wait for the lock as documented
Reporter:Andrey Solovyev (corruptor)Labels:
Date Opened:2010-10-25 06:00:27Date Closed:2012-01-10 16:08:01.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Functions/func_lock
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20101102__issue18207.diff.txt
Description:I am testing function LOCK and "core show function LOCK" says "LOCK will wait for the lock to become availables". NOTE says it will only attempt to lock for 3 seconds.
I've created simple dialplan and tested this function. LOCK doesn't wait for 3 seconds. It just returnes '0' and contunues through the dialplan.
We have a spacial for checking availability of the lock TRYLOCK so I assume LOCK has to wait and current behaviour is wrong.


****** ADDITIONAL INFORMATION ******

I've created simple dialplan to test.
exten => 0006,1,Noop(test)
exten => 0006,n,Set(Lock=${LOCK(aaa)})
exten => 0006,n,Noop(I am inside Lock)
exten => 0006,n,Wait(30)
exten => 0006,n,Set(Unlock=${UNLOCK(aaa)})
exten => 0006,n,Hangup

Then I called from the first phone.

[2010-10-25 14:50:41] VERBOSE[4915] pbx.c:     -- Executing [0006@internal-cos1:1] NoOp("SIP/1102-000000b0", "test") in new stack
[2010-10-25 14:50:41] VERBOSE[4915] pbx.c:     -- Executing [0006@internal-cos1:2] Set("SIP/1102-000000b0", "Lock=1") in new stack
[2010-10-25 14:50:41] VERBOSE[4915] pbx.c:     -- Executing [0006@internal-cos1:3] NoOp("SIP/1102-000000b0", "I am inside Lock") in new stack
[2010-10-25 14:50:41] VERBOSE[4915] pbx.c:     -- Executing [0006@internal-cos1:4] Wait("SIP/1102-000000b0", "30") in new stack

This channel has grabbed the lock successfully. I call from the second phone.
[2010-10-25 14:50:51] VERBOSE[4916] pbx.c:     -- Executing [0006@internal-cos1:1] NoOp("SIP/1101-000000b1", "test") in new stack
[2010-10-25 14:50:51] VERBOSE[4916] pbx.c:     -- Executing [0006@internal-cos1:2] Set("SIP/1101-000000b1", "Lock=0") in new stack
[2010-10-25 14:50:51] VERBOSE[4916] pbx.c:     -- Executing [0006@internal-cos1:3] NoOp("SIP/1101-000000b1", "I am inside Lock") in new stack
[2010-10-25 14:50:51] VERBOSE[4916] pbx.c:     -- Executing [0006@internal-cos1:4] Wait("SIP/1101-000000b1", "30") in new stack

This channels hasn't grabbed the lock and returned 0 immidiately.
Comments:By: Andrey Solovyev (corruptor) 2010-11-03 05:14:20

I've tested the patch. Now function works as expected.
Thank you.

By: Andrey Solovyev (corruptor) 2011-11-02 05:45:11.432-0500

The working solution has been provided one year ago but it hasn't been committed. Is it possible to resolve this?