Another approach attempted was to log stack frames to file from a separate thread. For example, the following code repeatedly writes the frames every 10 seconds. However, when Zope3 blocks, this thread also seems to stop.
def runforever(name):
import threadframe, traceback, time, sys
file = open(name, "w")
while True: file.write(">>>>>%s, number of threads = %d\n" % (time.strftime("%H:%M:%S"), len(threadframe.dict()))) time.sleep(10)
for id, frame in threadframe.dict().iteritems(): file.write("===== [%d] %s" % (id, sys.getrefcount(frame))) traceback.print_stack(frame, file=file) file.write("\n") file.flush()
Another approach attempted was to log stack frames to file from a separate thread. For example, the following code repeatedly writes the frames every 10 seconds. However, when Zope3 blocks, this thread also seems to stop.
def runforever(name):
file.write( ">>>>>% s, number of threads = %d\n" % (time.strftime( "%H:%M: %S"), len(threadframe .dict() )))
time.sleep( 10) dict(). iteritems( ):
file. write(" ===== [%d] %s" % (id, sys.getrefcount (frame) ))
traceback. print_stack( frame, file=file)
file. write(" \n")
file. flush()
import threadframe, traceback, time, sys
file = open(name, "w")
while True:
for id, frame in threadframe.
import thread start_new_ thread( runforever, ("/tmp/ thread1. log",))
thread.