[asterisk-dev] [Code Review] Resolve odbc segfaults by adding shared locks around usage of odbc handle in res_odbc

wdoekes reviewboard at asterisk.org
Wed Feb 8 02:33:37 CST 2012


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

Ship it!


Thanks for finishing it.
- I think you addressed all comments.
- The changes you made look good. (I didn't check for flaws in the original/unchanged parts.)
- Tested with mysql and postgres and it still fixes the crash.


/branches/1.8/include/asterisk/res_odbc.h
<https://reviewboard.asterisk.org/r/1719/#comment10022>

    +1 on the _wrlocked suffix. It beats '2' any single day.



/branches/1.8/res/res_odbc.c
<https://reviewboard.asterisk.org/r/1719/#comment10023>

    I'd prefer to replace this with:
    
      do_reconnect = (!obj->up && !obj->tx);
    
    then place a
    
      int do_reconnect = 1;
    
    at the top before if(!wrlock).
    
    And wrap the highlighted stuff here in a if (do_reconnect) {}.
    
    That way we won't have the duplicate comment+disconnect+connect code.



/branches/1.8/res/res_odbc.c
<https://reviewboard.asterisk.org/r/1719/#comment10024>

    s/locked/write-locked/


- wdoekes


On Feb. 7, 2012, 2:37 p.m., jrose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1719/
> -----------------------------------------------------------
> 
> (Updated Feb. 7, 2012, 2:37 p.m.)
> 
> 
> Review request for Asterisk Developers, Mark Michelson, Tilghman Lesher, rmudgett, and wdoekes.
> 
> 
> Summary
> -------
> 
> This is a continuation of wdoekes patch seen in https://reviewboard.asterisk.org/r/1622/
> This adds Tilghman Lesher's suggested changes.
> 
> 
> This addresses bug ASTERISK-19011.
>     https://issues.asterisk.org/jira/browse/ASTERISK-19011
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/include/asterisk/res_odbc.h 354164 
>   /branches/1.8/res/res_odbc.c 354164 
> 
> Diff: https://reviewboard.asterisk.org/r/1719/diff
> 
> 
> Testing
> -------
> 
> I started by confirming that the segfault could be easily reproduced with wdoekes' setup mentioned in the issue report.
> After finishing the changes to the patch, I confirmed that following the same steps no longer produced the segfault, undid the patch to double check that I was doing it right, and then decided it was safe to post this review.
> 
> 
> Thanks,
> 
> jrose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120208/f104fcc6/attachment-0001.htm>


More information about the asterisk-dev mailing list