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

IndexError when showing traceback at Pylons #135

Closed
sqlalchemy-bot opened this issue May 19, 2010 · 6 comments
Closed

IndexError when showing traceback at Pylons #135

sqlalchemy-bot opened this issue May 19, 2010 · 6 comments
Labels
bug Something isn't working low priority runtime

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Anonymous

Pylons has a _debug controller that shows past exception tracebacks. When a user follows the debug link shown in console an exception occurs:

Exception happened during processing of request from ('127.0.0.1', 49212)
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 1068, in process_request_in_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.6/SocketServer.py", line 615, in __init__
    self.handle()
  File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 442, in handle
    BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
  File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 437, in handle_one_request
    self.wsgi_execute()
  File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 287, in wsgi_execute
    self.wsgi_start_response)
  File "/usr/lib/pymodules/python2.6/paste/cascade.py", line 130, in __call__
    return self.apps[-1](environ, start_response)
  File "/usr/lib/pymodules/python2.6/paste/registry.py", line 375, in __call__
    app_iter = self.application(environ, start_response)
  File "/usr/lib/pymodules/python2.6/pylons/middleware.py", line 200, in __call__
    self.app, environ, catch_exc_info=True)
  File "/usr/lib/pymodules/python2.6/pylons/util.py", line 91, in call_wsgi_application
    app_iter = application(environ, start_response)
  File "/usr/lib/pymodules/python2.6/weberror/evalexception.py", line 233, in __call__
    return self.debug(req)(environ, start_response)
  File "/usr/lib/pymodules/python2.6/weberror/evalexception.py", line 535, in wsgi_application
    return self.content()
  File "/usr/lib/pymodules/python2.6/weberror/evalexception.py", line 545, in content
    result = tmpl_formatter(self.exc_value)
  File "/usr/lib/pymodules/python2.6/pylons/error.py", line 43, in mako_html_data
    css=False)
  File "/usr/lib/pymodules/python2.6/mako/template.py", line 189, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 403, in _render
    _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 434, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 457, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x249a510", line 54, in render_body
  File "/usr/lib/pymodules/python2.6/mako/exceptions.py", line 88, in __init__
    self.records = self._init(traceback)
  File "/usr/lib/pymodules/python2.6/mako/exceptions.py", line 201, in _init
    fp = open(new_trcback[-1][0], 'rb')
IndexError: list index out of range

In particular, trcback is None so any index value would raise an IndexError. This would also be Pylon's fault as the exception is not properly replayed.

A patch is attached.


Attachments: pylons_fix

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

need a test case (which does not require pylons). This is not a dupe of #132, correct ? that issue has been fixed.

@sqlalchemy-bot
Copy link
Author

Anonymous wrote:

I don't think it is a duplicate because the exception in this case is IndexError not AttributeError.

I can't manage to get a standalone test case, but as long as there is a way to raise a mako exception with an empty traceback (i.e. None), a mako IndexError will be generated.

@sqlalchemy-bot
Copy link
Author

Anonymous wrote:

This bug is related to [http://pylonshq.com/project/pylonshq/ticket/612 Pylons ticket #612]. It seems that each part blames the other, resulting in a developer deadlock.

I think Mako should catch IndexError and Pylons should not call the Mako html_error_template() with an empty traceback.

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

The traceback has to be blocked in two ways to reproduce so its barely a Mako issue, but having it degrade gracefully is desirable. 3ef596c

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority runtime
Projects
None yet
Development

No branches or pull requests

1 participant