Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotshot.stats.load fails with AssertionError #39948

Closed
sdahlbac mannequin opened this issue Feb 19, 2004 · 26 comments
Closed

hotshot.stats.load fails with AssertionError #39948

sdahlbac mannequin opened this issue Feb 19, 2004 · 26 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@sdahlbac
Copy link
Mannequin

sdahlbac mannequin commented Feb 19, 2004

BPO 900092
Nosy @warsaw, @amauryfa, @pitrou, @devdanzin
Files
  • 900092-patch.txt: Patch candidate for Python 2.4.x
  • 900092-patch-2.txt: Test suite patch
  • bug.prof: crasher from gsakkis
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-12-18.21:15:22.341>
    created_at = <Date 2004-02-19.08:05:42.000>
    labels = ['interpreter-core', 'type-bug']
    title = 'hotshot.stats.load fails with AssertionError'
    updated_at = <Date 2019-12-18.21:15:22.340>
    user = 'https://bugs.python.org/sdahlbac'

    bugs.python.org fields:

    activity = <Date 2019-12-18.21:15:22.340>
    actor = 'SilentGhost'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-12-18.21:15:22.341>
    closer = 'SilentGhost'
    components = ['Interpreter Core']
    creation = <Date 2004-02-19.08:05:42.000>
    creator = 'sdahlbac'
    dependencies = []
    files = ['1204', '1205', '1206']
    hgrepos = []
    issue_num = 900092
    keywords = ['patch']
    message_count = 26.0
    messages = ['20042', '20043', '20044', '20045', '20046', '20047', '20048', '20049', '20050', '20051', '20052', '20053', '20054', '82011', '89975', '110391', '110823', '110826', '110827', '114323', '214139', '214145', '214146', '214147', '214148', '214150']
    nosy_count = 9.0
    nosy_names = ['barry', 'glchapman', 'jlgijsbers', 'amaury.forgeotdarc', 'sdahlbac', 'gsakkis', 'pitrou', 'dstanek', 'ajaksu2']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue900092'
    versions = ['Python 2.7']

    @sdahlbac
    Copy link
    Mannequin Author

    sdahlbac mannequin commented Feb 19, 2004

    trying to do a

    hotshot.stats.load("myprofiling_file.prof")

    fails with assertionerror

    assert not self._stack

    python 2.3.2 on WinXP

    @sdahlbac sdahlbac mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Feb 19, 2004
    @jlgijsbers
    Copy link
    Mannequin

    jlgijsbers mannequin commented Sep 24, 2004

    Logged In: YES
    user_id=469548

    While the original report isn't very useful, I've ran into
    this problem multiple times as well. I can reproduce it
    using the attached profile file (compressed because of the
    large size) and the following console session:

    Python 2.3.4 (#2, Jul  5 2004, 09:15:05)
    [GCC 3.3.4 (Debian 1:3.3.4-2)] on linux2
    Type "help", "copyright", "credits" or "license" for more
    information.
    >>> import hotshot.stats
    >>> stats = hotshot.stats.load('roundup.prof')
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
      File "/usr/lib/python2.3/hotshot/stats.py", line 12, in load
        return StatsLoader(filename).load()
      File "/usr/lib/python2.3/hotshot/stats.py", line 51, in load
        assert not self._stack
    AssertionError
    >>>

    I'm not sure who's baby hotshot really is, so I'm leaving
    this unassigned.

    @jlgijsbers
    Copy link
    Mannequin

    jlgijsbers mannequin commented Sep 24, 2004

    Logged In: YES
    user_id=469548

    Hmm, the file was too big, even though it was compressed.
    I've uploaded it to
    http://home.student.uva.nl/johannes.gijsbers/roundup.prof.bz2
    now.

    @warsaw
    Copy link
    Member

    warsaw commented Sep 27, 2004

    Logged In: YES
    user_id=12800

    Could this be related to 1019882?

    @glchapman
    Copy link
    Mannequin

    glchapman mannequin commented Nov 8, 2004

    Logged In: YES
    user_id=86307

    I ran into this today, so I decided to look into it. It
    looks to me like the problem only happens if you profile
    with lineevents enabled. In that case, hotshot uses the
    tracer_callback function (in _hotshot.c) to dispatch trace
    events. This function explicitly ignores exception returns
    (PyTrace_EXCEPTION), which can lead to an unbalanced stack
    of calls/returns when the log is loaded (if an profiled
    function exits with an exception).

    It seems on the surface that tracer_callback ought to handle
    exceptions the same way as normal returns. This would be
    consistent with what happens when profiler_callback is used,
    since PyEval_EvalFrame dispatches sends a Py_RETURN to
    c_profilefunc when exiting because of an exception.

    @glchapman
    Copy link
    Mannequin

    glchapman mannequin commented Nov 8, 2004

    Logged In: YES
    user_id=86307

    Well, the superficial fix doesn't work (sorry for posting
    too soon). It turns out that PyTrace_EXCEPTION is sent for
    any exception, not just one causing the function to exit.
    So I guess the best fix may be to have hotshot always
    install its profiler_callback to handle CALLS and RETURNS,
    and then optionally install the tracer_callback to handle
    only LINEs. Anyway, that works for the one test case I've
    been using (a runcall of a function which simply does
    "import pickle").

    By the way, I'm testing with 2.4b1.

    @warsaw
    Copy link
    Member

    warsaw commented Jul 7, 2005

    Logged In: YES
    user_id=12800

    See 900092-patch.txt for a candidate patch against Python
    2.4.1. Props to Justin Campbell for most of the heavily
    lifting (but you can blame me for any problems ;).

    This fix restore the tracing of a 'return' event for
    exceptions that cause a function to exit.

    @warsaw
    Copy link
    Member

    warsaw commented Jul 8, 2005

    Logged In: YES
    user_id=12800

    900092-patch-2.txt fixes the test suite for the extra return
    event.

    @warsaw
    Copy link
    Member

    warsaw commented Aug 15, 2005

    Logged In: YES
    user_id=12800

    Patches applied for Python 2.4.2 and 2.5a1

    @gsakkis
    Copy link
    Mannequin

    gsakkis mannequin commented Feb 8, 2007

    Has this ever been reported again since it was closed ? I just got it today (python 2.5). The prof file is 11MB, I'll see if I can reproduce the bug with a smaller one.

    @gsakkis
    Copy link
    Mannequin

    gsakkis mannequin commented Feb 9, 2007

    Ok, I reduced the prof file to 38K. Can I upload an attachment here ? I don't see how.

    @brettcannon
    Copy link
    Member

    I think only OPs and project members can upload. Email it to me, George (brett at python.org), mention the bug # and I will upload it.

    @brettcannon
    Copy link
    Member

    Attaching the file George made.
    File Added: bug.prof

    @devdanzin
    Copy link
    Mannequin

    devdanzin mannequin commented Feb 14, 2009

    Has test, patch and sample data for reproducing.

    @devdanzin devdanzin mannequin changed the title hotshot.stats.load hotshot.stats.load fails with AssertionError Feb 14, 2009
    @devdanzin devdanzin mannequin added the type-bug An unexpected behavior, bug, or error label Feb 14, 2009
    @amauryfa
    Copy link
    Member

    amauryfa commented Jul 1, 2009

    I added some prints in the hotshot.stats.load function, this lead to
    interesting things:

    • first, the program seems to spawn subprocesses which trace themselves
      in the same file.

    • however, there is real issue when fork() is called on a traced
      program: calls to _execvpe should not appear in the trace!
      IMO PyOS_AfterFork should disable any trace or profile function.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 15, 2010

    Is it worth leaving this open, given this from section 26.5 of the 2.7 docs. "For common usage it is recommended to use cProfile instead. hotshot is not maintained and might be removed from the standard library in the future."

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 19, 2010

    Closing as hotshot is not maintained and is not documented in py3k.

    @BreamoreBoy BreamoreBoy mannequin closed this as completed Jul 19, 2010
    @briancurtin
    Copy link
    Member

    I don't think this should have been closed just yet. If the issue still exists in 2.x, it could still be fixed in the remaining 2.6 release, or any of the future 2.7 releases.

    You are right that it won't apply to 3.x since hotshot is gone there.

    @briancurtin briancurtin reopened this Jul 19, 2010
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 19, 2010

    Who of our overworked volunteers is going to do the work, given that hotshot doesn't even feature on the maintainers list?

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Aug 19, 2010

    Closing as no reply to msg110827.

    @BreamoreBoy BreamoreBoy mannequin closed this as completed Aug 19, 2010
    @briancurtin
    Copy link
    Member

    It was brought to my attention that this is still an issue and that it was closed. Reopening.

    @briancurtin briancurtin reopened this Mar 19, 2014
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Mar 19, 2014

    IMHO reopening this was a complete and utter waste of core devs time, its already passed its tenth birthday!!!

    @briancurtin
    Copy link
    Member

    It remains a valid issue. Time is not a factor.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Mar 19, 2014

    You clearly haven't bothered to read that there is *NO* maintainer, that the docs for 2.x recommend that you *DON'T* use it, that its been removed from 3.x and that nobody has yet volunteered to do anything with it. If its so important, why don't you do the work instead of trying to palm it off onto people who have far more important things to consider? I'll therefore repeat so that you very clearly get my message, this is a complete and utter waste of core devs time.

    @pitrou
    Copy link
    Member

    pitrou commented Mar 19, 2014

    Brian Curtin is a core developer, perhaps you should trust his judgement.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Mar 19, 2014

    Then God help Python is all I can say.

    @SilentGhost SilentGhost mannequin closed this as completed Dec 18, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants