[asterisk-dev] [Code Review] Try to avoid an infinite loop caused by a corrupted astdb

Terry Wilson reviewboard at asterisk.org
Thu Jun 9 13:38:51 CDT 2011


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

Review request for Asterisk Developers.


Summary
-------

The infinite loop is happening somewhere inside the Berkeley DB sequence processing code, but I haven't been able to figure out where or how to fix it. This patch modifies our code to first look up the last entry in the db (which does not hit the infinite loop problem), and use its key as a sentinel value when we iterate over the loop. Since there were four places the code would have to be changed, I got rid of some duplicate code and made a utility function to handle all calls to astdb->seq.

What I would rather do is replace the Berkeley DB 1 code (which hasn't been updated in around 15 years) with sqlite3 which is actively maintained, in the public domain, and part of every distribution known to man. Having built-in sqlite3 + a realtime option seems much better than the current setup. Writing a conversion utility for our usage of BDB1 should be fairly trivial.


Diffs
-----

  /branches/1.8/main/db.c 322168 

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


Testing
-------

Took a known corrupted DB and ensured the infinite loop was no longer a problem. Tried database put, show, del, and deltree to make sure that things worked as they did before.


Thanks,

Terry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110609/3767ad2b/attachment.htm>


More information about the asterisk-dev mailing list