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

test_threading.test_finalize_with_trace() fails on FreeBSD buildbot #62946

Closed
vstinner opened this issue Aug 15, 2013 · 4 comments
Closed

test_threading.test_finalize_with_trace() fails on FreeBSD buildbot #62946

vstinner opened this issue Aug 15, 2013 · 4 comments

Comments

@vstinner
Copy link
Member

BPO 18746
Nosy @ncoghlan, @pitrou, @vstinner, @koobs
Files
  • finalize_clear_trace.patch
  • 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 2013-12-13.01:54:54.197>
    created_at = <Date 2013-08-15.10:14:20.474>
    labels = []
    title = 'test_threading.test_finalize_with_trace() fails on FreeBSD buildbot'
    updated_at = <Date 2013-12-13.01:54:54.196>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2013-12-13.01:54:54.196>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-12-13.01:54:54.197>
    closer = 'vstinner'
    components = []
    creation = <Date 2013-08-15.10:14:20.474>
    creator = 'vstinner'
    dependencies = []
    files = ['31299']
    hgrepos = []
    issue_num = 18746
    keywords = ['patch']
    message_count = 4.0
    messages = ['195244', '195492', '196096', '206011']
    nosy_count = 4.0
    nosy_names = ['ncoghlan', 'pitrou', 'vstinner', 'koobs']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue18746'
    versions = ['Python 3.4']

    @vstinner
    Copy link
    Member Author

    The following test fails on FreeBSD buildbot:

        def test_finalize_with_trace(self):
            # Issue1733757
            # Avoid a deadlock when sys.settrace steps into threading._shutdown
            assert_python_ok("-c", """if 1:
                import sys, threading
    
                # A deadlock-killer, to prevent the
                # testsuite to hang forever
                def killer():
                    import os, time
                    time.sleep(2)
                    print('program blocked; aborting')
                    os._exit(2)
                t = threading.Thread(target=killer)
                t.daemon = True
                t.start()
    
                # This is the trace function
                def func(frame, event, arg):
                    threading.current_thread()
                    return func
    
                sys.settrace(func)
                """)

    I ran it manually on my FreeBSD 9.1 VM, I get the following error. I don't know if it's the same error than the buildbot.
    ----

    (...)
    # clear builtins._
    (...)
    # restore sys.stderr
    # cleanup __main__
    # cleanup[1] _sysconfigdata
    (...)
    # cleanup[1] threading
    Exception ignored in: <function WeakSet.__init__.<locals>._remove at 0x801b11058>
    Traceback (most recent call last):
      File "/usr/home/haypo/prog/python/default/Lib/_weakrefset.py", line 38, in _remove
      File "x.py", line 17, in func
    AttributeError: 'NoneType' object has no attribute 'current_thread'
    # cleanup[1] _weakrefset
    (...)
    # cleanup[3] _codecs
    PyThreadState_Clear: warning: thread still has a frame

    The weakref is probably threading._dangling.

    IMO Py_Finalize() should first clear the trace function. Tracing Python exception while Python is dying (exiting) is insane. I'm surprised that it works :-)

    @koobs
    Copy link

    koobs commented Aug 17, 2013

    I'm not sure if this issue is/was related, but it seems the commit addressing bpo-18178 has taken care of the test_finalize_runnning_thread failure.

    I note that your description specifies test_finalize_"with_trace", perhaps suggesting your reproduction case may be something slightly different?

    FWIW, I don't think I've seen the 'with_trace' test fail on my buildbots (but correct me if I'm wrong)

    After the commit mentioned above, the FreeBSD 10 buildbot is now green on all branches.

    @vstinner
    Copy link
    Member Author

    It may be related to bpo-18408 (changeset 5bd9db528aed) and bpo-18664.

    @vstinner
    Copy link
    Member Author

    I don't see this issue anymore on FreeBSD buildbots. It was probably fixed. The issue bpo-19466 changed also the Python shutdown procedure.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants