[asterisk-users] Asterisk 1.2 and res_perl - lock that leads to weird behaviour

Edoardo Serra edoardo.serra at webrainstorm.it
Sun Apr 1 09:22:33 MST 2007


Hi guys,
	as I wrote in a previous thread I was experiencing dropped audio 
(apparently randomly) and SIP + IAX peers getting REACHABLE / 
UNREACHABLE without reason, servers were in the same LAN.

Investingating deeply in the problem I also noticed that 'show channels' 
command on the CLI, sometimes were returning strange results, for 
example it wasn0t showing some channels I was sure were active.

Looking at our DB's log, I also notited there were a race condition 
which could lock a query for a long time (up to 30 secs)
I don't want to annoy you wit DB issues explaining why it happened

My Asterisk dialplan, when a user try to place a call, make a query to 
our db (through res_perl) to check some parameters, among them the 
user's credit to set the maximum duration of a call.

If that perl script does not end in a reasonable time (I cannot tell how 
much is reasonable, but the 30secs due to the lock were surely too many)
and other users try to call (and also their queries get locked) Asterisk 
begins causing weird problems.
(I saw on res_perl documentation that it acquires some lock in asterisk 
during scripts execution but I didn't imagine that locks could affect 
the whole Asterisk box)

Common problems in these cases are peers qualified as UNREACHABLE, 
dropped audio (sometimes in both directions, sometimes in just one 
direction), channels missing in 'show channels', etc....

I solved the race condition at db level and problem have magically 
disappeared but I'd like to go deep in the problem, I wouldn't like that 
o happen again because of a slow query or sloq execution of a perl 
script (it could happen for a lot of reasons)

Someone can help with that ?
Sorry for the crosspost but I think also asterisk-devel could be 
involved in it.

Tnn in advance for help

Regards

Edoardo Serra
WeBRainstorm S.r.l.



More information about the asterisk-users mailing list