-
Notifications
You must be signed in to change notification settings - Fork 89
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
Clarify error page mechanism with regards to committed and async #256
Comments
exceptions thrown when the response is already committed What should the container do if the response is already committed when an exception is thrown from the filter(s)/servlet?
Should the error page dispatch be done regardless to inform the application? However, if the request is asynchronous, then it is not possible for the container to safely check the committed status of the response, as that will be a race with any asynchronous processing. Thus exceptions thrown for async requests need to be handled in a way that does not directly depend on committed status (see next comment). |
exceptions thrown when the request is async started (or states beyond) What should the container do if the request is async when an exception is thrown from the filter(s)/servlet? This is currently specified in 2.3.3.3:
However, this does not discuss how the exception should be handled if the async request has already been completed or dispatched? If the async is started, then handling of an exception can be done as per 2.3.3.3 above - ie call onError handlers and if none of them call complete/dispatch to an ERROR dispatch. Note that it is impossible to tell if a complete/dispatch call is done by the If Note that if the 2.3.3.3 processing determines that an error dispatch should be done, then the committed problem of the previous comment still applies. Thus we should modify 2.3.3.3ii to say that if the response is committed, the container will attempt to whatever protocol options are available to indicate a non-nominal response and will not do the error dispatch. |
sendError called by an async thread sendError can be called by an asynchronous thread with the request in at least the following states:
** sendError called during dispatch when async started**
Note that the original dispatch calls sendError after AsyncContext.dispatch has already been called can be handled with a ISE as this is essentially attempting a dispatch of a committed response. Note also that it is essentially impossible to distinguish between these two sets of cases as it is not generally possible to know if sendError is being called by the normal asynchronous processing or by the original dispatch. A well behaved async thread should call sendError as follows: response.sendError(code);
asyncContext.complete(); Since the sendError handling may involve a error dispatch, which itself may do startAsync and do asynchronous handling, then the sendError handling needs to be deferred until after the Furthermore, as sendError processing can involve an error dispatch and it is not allowable to do this when there is already a dispatch active, then any sendError processing needs to also be deferred until after the original dispatch has returned. Once the original dispatch has returned normally and But what if the original dispatch throws an exception after Thus 2.3.3.3 needs to be made to delay the error dispatch of
|
The error page mechanism defined in section 10.9.2 can be invoked either by an explicit call to sendError or by an exception being thrown from a dispatch to filter(s) and servlet.
However, the current text is not clear what should be done in all possible states with regard to being committed and/or asynchronous states:
The text was updated successfully, but these errors were encountered: