[Tutor] segmentation fault

Chris Fuller cfuller084 at thinkingplanet.net
Sun Jul 12 19:21:46 CEST 2009


On Sunday 12 July 2009 11:09, Rick Pasotto wrote:
> I've got a script that I wrote several years ago and have been happily
> using daily. Suddenly when I try to run it I get a segmentation fault.
>
> I'm running debian testing so probably some recent update caused the
> breakage. How can I find out what's gone wrong?

Crashing the Python interpreter isn't easy.  The most common ways I've seen 
are errors in C extensions, unpickling, and the ctypes module.

You might have some C extensions that need to be recompiled for the new 
version of Python, or an update to your C extensions that requires a newer 
version of Python.

The usual troubleshooting advice applies.  Strategically placed print 
statements (I actually prefer using UDP sockets for logging), separate your 
code into blocks and see if you can narrow down where the error is occurring, 
use a debugger, etc.

Depending on the complexity of your code, you might even be able to find out 
if there's some input somewhere that isn't validated, although this probably 
isn't the problem in your case.

At each step, verify what you think you've learned.  If it isn't repeatable, 
you can't test the fix.

But yeah, check for resource exhaustion too.  That one can bite you 
unexpectedly.

Cheers


More information about the Tutor mailing list