Edgewall Software
Modify

Opened 15 years ago

Closed 14 years ago

#8585 closed defect (fixed)

Errors can occur in Chrome.prepare_request() during Request.send_error()

Reported by: ebray Owned by: Christian Boos
Priority: normal Milestone: 0.12
Component: web frontend Version: 0.11-stable
Severity: normal Keywords: error
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

There are some cases where, when an error occurs sne send_error() is being called, that Chrome.prepare_request() can error out too, leaving the client with nothing but a traceback.

In particular, this occurs during some database errors, such as good ol' 'database is locked'. The problem comes from the fact that in prepare_request() the navigation_contributors are looped through, and get_navigation_items() is called for each of them. However, some navigation_contributors access the database, for example, for permission lookups. This can lead to another 'database is locked'.

I think that if the handler argument to prepare_request() is None, this step should be skipped. Or only certain navigation items should be displayed. For example, in my implementation, all the mainnav items are removed from the page, as are all the metanav items except for those added by the LoginModule. Just another possibility. At any rate, if handler is None, I can't imagine any other reason to generate the navigation items.

Should also make sure that before calling req.send_error(), req.callbacks['chrome'] is in fact set to chrome.prepare_request() and not a partial function.

As an aside, the motivation for this is a plugin I wrote called TracFailWhale that displays a more user-friendly error message when there are database availability issues. It includes some ugly hacks to get around this problem, which I would prefer to avoid. And I think my proposed solution makes sense.

Attachments (2)

more-robust-error-reporting.patch (4.9 KB ) - added by Christian Boos 15 years ago.
Make preparation of request more robust w.r.t. failures in navigation contributors. Currently on 0.11-stable r8704.
no-FakeRequest.patch (3.2 KB ) - added by Christian Boos 15 years ago.
Get away with the FakeReq class in the Chrome.prepare_request Request callback. Applies on top of more-robust-error-reporting.patch.

Download all attachments as: .zip

Change History (10)

comment:1 by Christian Boos, 15 years ago

Keywords: error added
Milestone: 0.12

I wonder if it wouldn't be possible to first try to get the navigation items, and if that fails, proceed anyway. If you don't have any navigation item, how do you resume working after an error happened?

See also #8468 for another attempt to reduce the occurrence of the good ol' one ;-)

in reply to:  1 comment:2 by anonymous, 15 years ago

Replying to cboos:

If you don't have any navigation item, how do you resume working after an error happened?

Well, in the case of my failwhale plugin, it tries refreshing the page anyways, at which point it should be possible to resume work. But you have a point—*some* form of navigation might be desired.

comment:3 by Remy Blank, 15 years ago

Milestone: 0.12next-minor-0.12.x

This shouldn't block 0.12.

comment:4 by Christian Boos, 15 years ago

Component: generalweb frontend
Owner: set to Christian Boos
Status: newassigned

I have a patch for this, please review.

by Christian Boos, 15 years ago

Make preparation of request more robust w.r.t. failures in navigation contributors. Currently on 0.11-stable r8704.

by Christian Boos, 15 years ago

Attachment: no-FakeRequest.patch added

Get away with the FakeReq class in the Chrome.prepare_request Request callback. Applies on top of more-robust-error-reporting.patch.

comment:5 by Christian Boos, 15 years ago

(the patches also apply on trunk)

comment:6 by Christian Boos, 14 years ago

Milestone: next-minor-0.12.x0.12
Resolution: fixed
Status: assignedclosed

Patches above applied on trunk, in r8760 and r8761.

comment:7 by Christian Boos, 14 years ago

Resolution: fixed
Status: closedreopened

Note that errors other than TracError still go through. I'll try to improve that.

comment:8 by Christian Boos, 14 years ago

Resolution: fixed
Status: reopenedclosed

More robust error rendering implemented in [8785].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.