Re: Adaptor modification - WOResponse streaming failure detection
Francis Labrie <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Ben Scarola wrote:
> Can someone validate my findings on this? The stock WO Apache adaptor
> does not detect a broken pipe on the client side while streaming a
> response. This means that the WOResponse will always read its entire
> source InputStream and in turn dump all the content to the adaptor,
> even if the pipe from Apache to the client is broken.
Interesting! Did you report this problem to Apple
(https://bugreport.apple.com/)?
Maybe it would be nice to add this patch the Wonder
(http://wonder.sourceforge.net/) enhanced HTTP adaptors as well?
> I've traced this behavior to a loop inside SendResponse() in
> mod_WebObjects.c (line 465) and added the lines below (indicated with
> ---->). By inspecting Apache's "conn_rec" you can detect an aborted
> connection and break out of the loop. This cause the WOResponse to
> immediately stop reading data from its InputStream, and also cause a
> broken pipe in the WOWorkerThread.
>
> Now when WOResponse calls InputStream.close(), read() will return >= 0
> if the InputStream was not fully processed, allowing the application
> to detect a failed transmission. Does anyone see adverse side effects
> of this modification? If a client disconnects from Apache is there any
> chance that the pipe can be re-established?? Is there a reason for WO
> to keep dumping data on the adaptor?
>
> if ( (!r->header_only) && (resp->content_valid) ) {
> while (resp->content_read < resp->content_length)
> {
> ap_soft_timeout("sending WebObjects response", r);
> ap_rwrite(resp->content, resp->content_valid, r);
> ap_kill_timeout(r);
> ----> if (r->connection->aborted) {
> ----> break;
> ----> }
> resp_getResponseContent(resp, 1);
> }
> ap_soft_timeout("sending WebObjects response", r);
> ap_rwrite(resp->content, resp->content_valid, r);
> ap_kill_timeout(r);
> }
Kind regards,
--
Francis Labrie
Saint-Bruno-de-Montarville, Québec, Canada