[lxml-dev] Tracking down bugs
Stefan Behnel
stefan_ml at behnel.de
Thu Dec 4 15:37:41 CET 2008
Hi,
thanks for the report.
Filip Salomonsson wrote:
> lxml occasionally goes crashing on me, with an error message and
> backtrace like the one below. Usually, the same program runs just fine
> if I try again. What can I do to track down the cause?
First of all, use the latest released (!) version of lxml and build it
without having Cython installed and with debug symbols enabled (add "-g3"
to your CFLAGS) so that the stack trace shows line numbers that can be
looked up in the released sources.
Then, install valgrind and try to make your program crash under valgrind
control. Valgrind usually gives pretty accurate information about the
origin of a bad memory location, so that's a lot more informative than a
bare stack trace. There is a command line in the Makefile (make valtest)
that you can use to find the appropriate options.
Stripping down your program to a shorter snippet that shows the crash more
or less reliably is a very good way to track down the circumstances that
are required to trigger the problem. In the best case, you end up with a
short test case that we can add to lxml's test suite to make sure the
problem never comes back.
Lastly, if you know how to use gdb and can investigate a bit more, any
further hints that you find can be helpful in tracking down the problem.
Thanks,
Stefan
More information about the lxml-dev
mailing list