[Zope-dev] Re: more on the segfault saga

Matthew T. Kromer matt@zope.com
Tue, 19 Mar 2002 16:10:04 -0500


Leonardo Rochael Almeida wrote:

>
>The official unofficial Zope place on irc is #zope at
>irc.openprojects.net. Lots of cool and very knowledgeable people hang
>out there.
>

OK, I put up a set of patches and a rather frazzled looking README for a 
profiler patch to Python at

http://www.zope.org/Members/matt

You want the C profiler patch; you have to build your OWN python 2.1.2 
and it will probably only work under Linux -- dont bother with Windows, 
parts of the code use mmap() for speed and Windows doesn't provide mmap.

There's a README document inside that has some rather vague and minimal 
installation instructions.  This is very definately use-at-your-own-risk 
stuff.  I'm posting notice here because others are interested in trying 
to help diagnose the Zope crashing problem so this serves as a reminder 
of where something is as it sits in your inbox waiting for bits to decay.

Here's the readme in its entirety:


To activate python tracing

Rebuild a clean python 2.1.2 with the two patches (included) applied.

Patch 1 is for the garbage collector module, it installs a segfault handler
which allows for an environment variable  CRASHCMD  to be present to
tell python what to do in the event of a segfault.

Patch 2 is a patch to ceval.c which builds in addtional tracing.

The cprof module must be built; a simple

        make -f Makefile.pre.in PYTHON=/path/to/rebuilt/python2.1.2

will build the cprof module.


Once built, test the cprof module


/path/to/rebuild/python2.1.2

 >>>import cprof
 >>>cprof.activate()
 >>>cprof.dump("filename")

and the filename specified should be created.  For the curious, the pb.py
program will "play back" the trace file to get data out of it.

**** PATCHING ZOPE TO USE THIS ****

Replace Zope's ZServer/PubCore/ZServerPublisher file with the included one.
Patch the line that contains the gdb command to point to your rebuilt 
python.

Copy the file gdb.cmd to where you start Zope.

Copy the file cprof.so to lib/python in your Zope directory

Start Zope.  Wait.  GDB will be invoked to gather crash data, save the
gdb output if possble (keep stdout from gdb).


Unfortunately, the README forgets to mention that you need to run Zope 
under the patched python.  Whoops.

-- 
Matt Kromer
Zope Corporation  http://www.zope.com/