2

we are trying to setup gunicorn + plone. It works well so far, but fails to handle errors (404, 500 etc) and throws 'Internal Server Error' while it should return plone's error page.

Example case of requesting a page that doesn't exist is pasted below. The question is how should gunicorn be setup so that errors are handled themselves by zope/plone, as other requests?

Cheers and regards

==> var/log/gunicorn-stdout---supervisor-JhaTfg.log <==
2012-05-24 01:41:16 [15137] [ERROR] Error handling request
Traceback (most recent call last):
  File "/home/user/testing/eggs/gunicorn-0.14.3-py2.6.egg/gunicorn/workers/sync.py", line 100, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/user/testing/eggs/repoze.retry-1.0-py2.6.egg/repoze/retry/__init__.py", line 90, in __call__
    app_iter = self.application(environ, replace_start_response)
  File "/home/user/testing/eggs/repoze.tm2-1.0b2-py2.6.egg/repoze/tm/__init__.py", line 24, in __call__
    result = self.application(environ, save_status_and_headers)
  File "/home/user/testing/eggs/repoze.vhm-0.14-py2.6.egg/repoze/vhm/middleware.py", line 106, in __call__
    return self.application(environ, start_response)
  File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/WSGIPublisher.py", line 255, in publish_module
    response = _publish(request, 'Zope2')
  File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/WSGIPublisher.py", line 185, in publish
    object = request.traverse(path, validated_hook=validated_hook)
  File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/BaseRequest.py", line 518, in traverse
    return response.notFoundError(URL)
  File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/HTTPResponse.py", line 718, in notFoundError
    "<p><b>Resource:</b> %s</p>" % escape(entry))
NotFound:   <h2>Site Error</h2>
  <p>An error was encountered while publishing this resource.
  </p>

1 Answer 1

0

On my question I forgot to mention that we are using WSGI Zope and gunicorn.

In our scenario, we patched ZPublisher/WSGIPublisher.py to properly handle NotFound exceptions (404), instead of throwing 500 Internal Server Error.

Turns up that Zope + Wsgi is still not so mature (at least on error handling).

1
  • you can and should edit your question instead of adding an answer
    – Claudiu
    Aug 16, 2012 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.