[asterisk-dev] [Code Review] Try to avoid an infinite loop caused by a corrupted astdb
David Vossel
reviewboard at asterisk.org
Thu Jun 9 14:19:19 CDT 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1259/#review3701
-----------------------------------------------------------
Ship it!
I don't like treating the symptoms of bugs rather than the bug itself, but considering the circumstances this fix is probably safer than trying to alter that crazy old code. It might be worth considering adding some tests to the test suite for this sort of thing if they don't already exist.
- David
On 2011-06-09 13:38:50, Terry Wilson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1259/
> -----------------------------------------------------------
>
> (Updated 2011-06-09 13:38:50)
>
>
> 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/1f3919c1/attachment-0001.htm>
More information about the asterisk-dev
mailing list