[asterisk-dev] [Code Review] Don't run the atexit functions more than once

Terry Wilson reviewboard at asterisk.org
Sun Jan 8 11:50:55 CST 2012


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

(Updated Jan. 8, 2012, 11:50 a.m.)


Review request for Asterisk Developers, wdoekes and Matt Jordan.


Changes
-------

ast_run_atexits already happens past where you can cancel. Adding locks should be sufficient.


Summary
-------

Asterisk can get multiple calls to the quit_handler from different threads. This can result in the atexit functions running multiple times. In one case, this causes multiple calls to the xmlCleanupParser() function which causes a double free and crash. I initially tried to handle things in quit_handler, but only succeeded in making some consoles never exit. :-)


This addresses bug ASTERISK-18883.
    https://issues.asterisk.org/jira/browse/ASTERISK-18883


Diffs (updated)
-----

  /trunk/main/asterisk.c 350018 

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


Testing
-------

Threw tons of asterisk -rx "core stop gracefully" calls in a loop at a bunch of 'asterisk -vvvgc' instances that were also starting in loops until it crashed. After the patch, it stopped crashing.


Thanks,

Terry

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


More information about the asterisk-dev mailing list