Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(especially': 0.07; 'debugging': 0.07; 'modified': 0.07; '"c"': 0.09; 'debugger': 0.09; 'function,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stack,': 0.09; 'stack.': 0.09; 'thus,': 0.09; 'python': 0.11; 'thread': 0.14; 'called,': 0.16; 'components.': 0.16; 'debugged': 0.16; 'destructor.': 0.16; 'intervening': 0.16; 'observations': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'extensions': 0.16; 'pushed': 0.16; 'do.': 0.18; 'module': 0.19; 'stack': 0.19; 'appears': 0.22; 'example': 0.22; 'header:User- Agent:1': 0.23; 'looks': 0.24; 'skip:" 20': 0.27; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; '(which': 0.31; 'code': 0.31; 'usually': 0.31; '(on': 0.31; 'writes:': 0.31; '(e.g.': 0.33; 'could': 0.34; 'case,': 0.35; 'but': 0.35; 'there': 0.35; 'doubt': 0.36; 'functions.': 0.36; 'i.e.': 0.36; 'maintained': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'should': 0.36; 'list': 0.37; 'easily': 0.37; 'being': 0.38; 'sometimes': 0.38; 'server': 0.38; 'problems': 0.38; 'to:addr :python-list': 0.38; 'explain': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'mentioned': 0.61; 'new': 0.61; 'back': 0.62; 'received:217': 0.63; 'information': 0.63; 'places': 0.64; 'linked': 0.65; 'fact,': 0.69; 'obvious': 0.74; 'activated': 0.84; 'local,': 0.84; 'observed': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: Missing stack frames? Date: Thu, 05 Jun 2014 08:24:31 +0200 References: <87fvjlv22v.fsf@vostro.rath.org> <87oay8pobi.fsf@rath.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e0adac.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:BKptWMzNL0/YnR34/GfCI3Uhoyg= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401949488 news.xs4all.nl 2925 [2001:888:2000:d::a6]:59418 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72681 Nikolaus Rath writes: > ... > Is there a way to produce a stacktrace without using the interactive > debugger? There is the "threadframe" package (on "PyPI"). It has helped me much to analyse problems in multithreaded programs (e.g. as part of "haufe.requestmonitoring"). However, I doubt that it will help in your case: I also have used interactive debugging for multithreaded programs; it is true that is sometimes very difficult (especially when the debugger gets activated in several threads at once and I no longer know which debugger instance gets my input) but I never observed that stack frames have been lost: in fact, I do not see any reason why the debugger could do that: the debugger activity is part of the thread being debugged and the stack frames are thread local, i.e. they cannot be modified by other threads -- thus, the debugger should see a consitent stack, independently of what other threads do. C extensions can cause stack frames to (apparently) be missed. The Python stack is a linked list of frames the head of which is maintained in the thread description. When Python calls a Python function, it pushes a new stack frame onto this stack. However, when a C function is called, this usually does not have an associated stack frame. When the C function calls a Python function, a stack frame for it is pushed and looking at the stack frames, it appears as if the Python function has been called at the place of the C function. >From the information you have provided in this discussion, I cannot see whether this can explain your observations: In your case, "C" extensions may be involved but they should not call back to Python functions. Someone else already mentioned that the "close" call can come from a destructor. Destructors can easily be called at not obvious places (e.g. "s = C(); ... x = [s for s in ...]"; in this example the list comprehension calls the "C" destructor which is not obvious when one looks only locally). The destructor calls often have intervening C code (which one does not see). However, in your case, I do not see why the "cgi" module should cause a destructor call of one of your server components. To summarize: I am as confused by your observations as you are and cannot give a satisfactory explanation.