AttributeError, dogslow in peek

Issue #18 resolved
olevinsky created an issue
Types:  AttributeError
Value:  'NoneType' object has no attribute '__name__'
Location:   dogslow/__init__.py in peek , line 196
Stacktrace (most recent call last):

  File "dogslow/__init__.py", line 196, in peek
    extra['culprit'] = '%s in %s' % (module.__name__, frame.f_code.co_name)

Comments (8)

  1. Владислав

    Same throube. Dogslow failed.

    Stacktrace (most recent call last):
    
      File "dogslow/__init__.py", line 96, in peek
        frame = sys._current_frames()[thread_id]
    
  2. John Watson

    I see this with the gevent worker class, but not with sync. FWIW, while the documentation does say that Dogslow is intended for synchronous workers, it doesn't claim that it won't work with gevent.

  3. olevinsky reporter

    python 2.7, uwsgi, dogslow==0.9.7

    Types:  KeyError
    Value:  139657006073600
    Location:   dogslow/__init__.py in peek , line 194
    
    
      File "dogslow/__init__.py", line 194, in peek
        frame = sys._current_frames()[thread_id]
    
    request <WSGIRequest at 0x110671760>
    started datetime.datetime(2014, 2, 13, 15, 54, 47, 886870)
    thread_id   139657006073600
    
  4. Thomas Smith

    This is fixed in the latest RC release (0.9.8-rc3):

    diff --git a/dogslow/__init__.py b/dogslow/__init__.py
    index 8d82da1..8c768fb 100644
    --- a/dogslow/__init__.py
    +++ b/dogslow/__init__.py
    @@ -127,8 +140,9 @@ class WatchdogMiddleware(object):
    
                 # This is a bizarre construct, `module` in `function`, but
                 # this is how all stack traces are formatted.
    -            extra['culprit'] = '%s in %s' % (module.__name__,
    -                                             frame.f_code.co_name)
    +            extra['culprit'] = '%s in %s' % (
    +                getattr(module, '__name__', '(unknown module)'),
    +                frame.f_code.co_name)
    
                 # We've got to simplify the stack, because raven only accepts
                 # a list of 2-tuples of (frame, lineno).
    
  5. Log in to comment