Ok, got some data on using this patches. First of all, for those following, these patches don't seem to work well if starting Zope as root, cause gdb will be started as the user Zope turns to, and this gdb won't be able to attach to a root started process, even if it's dropped it's privileges. Now, the gdb.cmd script that comes with it is not being able to make the trace_dump file for some reason. Below are the urls to Zope's stdout/err in 2 segfault instances, one generated by an external method that calls cprof.segfault() and another that was generated by normal load. http://www.ibccrim.org.br/imagens/data-temp/stdout-20020321-ext-method-segfa... http://www.ibccrim.org.br/imagens/data-temp/stdout-20020321-natural-segfault The 'No such process' message might be caused by the process dying while trying to generate the file in the trace_dump() call, but I don't know why would that be. I'll see if I can install another Zope instance where it all belongs to another user, so that we can rule out lack of permissions for this problem. On Tue, 2002-03-19 at 18:10, Matthew T. Kromer wrote:
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/
-- Ideas don't stay in some minds very long because they don't like solitary confinement.