Skip to content

AttributeError: 'ProfileSummaryModule' object has no attribute 'start' #28

Open

Description

@kevinrenskers

I often get this error: AttributeError: 'ProfileSummaryModule' object has no attribute 'start'. I run with werkzeug on.

Traceback: http://paste.pocoo.org/show/369519/

The weird thing is that if I remove 'devserver.modules.profile.ProfileSummaryModule' from DEVSERVER_MODULES, reload the page and then re-add it and reload the page, it suddenly does work.

Activity

  1. ebaumgartner commented on Apr 26, 2011

    @ebaumgartner

    I think the broader issue is that the profile module doesn't handle the case where a different middleware object returns a valid HttpRequest. When this happens the middleware objects later in the request chain (which includes DevServerMiddleware, which sits at the end) don't get their process_request() method called. Which means no modules will get their process_init() method called.

    But all the middleware objects' process_response() methods do get called, so DevServerMiddleware calls all modules' process_response(), and that's where the profile module breaks.

    The profile module isn't guarding for this case. So one fix would be to make all modules more defensive about having their process_response() called without process_init().

    Or, I think someone has suggested having DevServerMiddleware insert itself in the front of the middleware list, instead of at the end. (This may have other consequences.)

    Or maybe DevServerMiddleware can check in process_response() to see it ever saw the request associated with the response, and if it did not, it protects its modules and doesn't call them in this case.

    I'm not sure which approach makes the most sense. If it's ok to lose DevServer functionality for the cases where middleware responses are triggered, I guess I'd lean towards the last option. But if you want to be able to profile the middleware responses, prepending DevServerMiddleware may be the best option.

  2. dlo commented on Jul 22, 2011

    @dlo

    Running into this too. Makes debugging a total nightmare.

  3. added a commit that references this issue on Aug 9, 2011
    0e2d1c0
  4. acdha commented on Aug 9, 2011

    @acdha
    Contributor

    I got tired of this failing all the time on my django-localeurl-using site: acdha/django-devserver@0e2d1c0

    I like the idea of inserting ahead of the middleware list to be able to profile other middleware but that would be a much more invasive change. It seems like long-term it would be better to move state to either the request object or the cache and refactor everything to do a get/getattr with graceful failure handling.

  5. added a commit that references this issue on Aug 26, 2011
  6. TylerBrock commented on Aug 28, 2011

    @TylerBrock

    Bump! It would be great if this got fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions