[Python-bugs-list] [ python-Bugs-744841 ] Python-Profiler bug: Bad call
SourceForge.net
noreply@sourceforge.net
Wed, 25 Jun 2003 08:27:58 -0700
Bugs item #744841, was opened at 2003-05-28 06:02
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=744841&group_id=5470
Category: Python Interpreter Core
Group: Python 2.1.2
>Status: Closed
>Resolution: Out of Date
Priority: 5
Submitted By: Dieter Maurer (dmaurer)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python-Profiler bug: Bad call
Initial Comment:
There is a timing problem between the call of
"call_trace(profile_func,...,'return',...)" and
"reset_exc_info" in Pythons main interpreter loop.
The main loop first calls "call_trace" (at the end of
function execution). With the
standard "profile.Profile" profiler this leads to a pop
of the current frame from the profiler stack while
the current frame is still on the interpreter stack.
Then "reset_exc_info" is called. When this call releases
an instance with a destructor ("__del__" method), the
"call_trace(profile_func,...'call',...)" for the destructor
observes the inconsistency between the profiler and the
interpreter stack and raises a "Bad call" exception. This
exception disables profiling effectively. However, the
exception is later ignored (as we are in a destructor) and
program execution continues. When the profiling is later
finished, all time after the exception is accounted for the
last function, that was on top of the profiler stack when
profiling was disabled. This can be extremely confusing.
The attached script reproduces the problem. Run it
through the Python interpreter. When you see an
"Exception Bad call ... ignored", the interpreter has the
described problem. We observed the problem in Python
2.1.3
(on Linux, Solaris and Windows).
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-06-25 10:27
Message:
Logged In: YES
user_id=80475
I've run your script on Py2.2.3 and 2.3b1+ and did not
observe "Exception Bad cad ... ignored".
Marking this one as already fixed.
----------------------------------------------------------------------
Comment By: Dieter Maurer (dmaurer)
Date: 2003-06-06 03:23
Message:
Logged In: YES
user_id=265829
Apparently, a colleague observed the bug also in Python 2.2.2.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-28 19:01
Message:
Logged In: YES
user_id=33168
The good news is that this has been fixed in Python 2.2.x
and beyond.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=744841&group_id=5470