[asterisk-dev] [Code Review] 2454: Fix lock errors on startup

svnbot reviewboard at asterisk.org
Thu Apr 18 11:39:29 CDT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2454/
-----------------------------------------------------------

(Updated April 18, 2013, 11:39 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 386006


Repository: Asterisk


Description
-------

I started noticing some messages that I didn't recognize while I was
working on Stasis:

  message.c line 1017 (msg_tech_hash): Error obtaining read lock: Invalid argument
  message.c line 1021 (msg_tech_hash): Error releasing rwlock: Invalid argument

I thought it was maybe something I did, so I tracked it down. Turns
out to have been this way for a while.

In messages.c, there are several places in the code where we create a
tmp_tech_holder and pass that into an ao2_find call. Unfortunately, we
weren't initializing the rwlock on the tmp_tech_holder, which the hash
function was locking. It's apparently harmless, but still not the best
code.

This patch extracts all that copy/pasted code into two functions,
msg_find_by_tech and msg_find_by_tech_name, which properly initialize
and destroy the rwlock on the tmp_tech_holder.


Diffs
-----

  /branches/11/main/message.c 385815 

Diff: https://reviewboard.asterisk.org/r/2454/diff/


Testing
-------

Verified that the message is no longer printed.


Thanks,

David Lee

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130418/3c944a84/attachment.htm>


More information about the asterisk-dev mailing list