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

Fix periodic timer error on interpreter shutdown #423

Merged
merged 1 commit into from
Sep 24, 2019

Commits on Aug 13, 2019

  1. Fix periodic timer error on interpreter shutdown

    The current hack does not work, as I'm still able to see such messages in the
    log:
    
      Exception in thread Thread-1 (most likely raised during interpreter shutdown):
      Traceback (most recent call last):
        File "pyenv/versions/2.7.12/lib/python2.7/threading.py", line 801, in __bootstrap_inner
        File "python/lib/python2.7/site-packages/datadog/threadstats/periodic_timer.py", line 43, in run
        File "pyenv/versions/2.7.12/lib/python2.7/threading.py", line 614, in wait
        File "pyenv/versions/2.7.12/lib/python2.7/threading.py", line 355, in wait
      <type 'exceptions.TypeError'>: 'NoneType' object is not callable
    
    This changes the current code to leverage the same hack that the `threading`
    library uses: if the `sys` module is None, there's a good chance that's because
    the interpreter is shutdown down.
    
    This change also improves the waiting loop by using the return value from
    `Event.wait()` which returns the value of the flag. That makes the thread
    faster to quit when `end()` is called.
    jd committed Aug 13, 2019
    Configuration menu
    Copy the full SHA
    d693d52 View commit details
    Browse the repository at this point in the history