You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Cox, Charlie" <cc...@cincom.com> on 2001/10/18 18:41:49 UTC

RE: cancelled request(more info)

I noticed in the iis_redirect.log(debug on) that I get the following error
when I click cancel for my download.
[jk_isapi_plugin.c (355)]: jk_ws_service_t::write, WriteClient failed
[jk_ajp12_worker.c (596)]: ajpv12_handle_response, error writing back to
server

But then at the time that the download would have completed, I get the
following in the log(no more 'write' messages in between)

[jk_ajp12_worker.c (590)]: ajpv12_handle_response, response body is done
[jk_ajp12_worker.c (602)]: ajpv12_handle_response done
[jk_isapi_plugin.c (551)]: HttpExtensionProc service() returned OK
[jk_ajp12_worker.c (163)]: Into jk_endpoint_t::done

Does the isapi filter within IIS notify Tomcat that it gets this error? It
doesn't appear to be sending the error back to tomcat.

Or could it be that since I am writing so much to the output stream that
tomcat does not get the opportuninty to check for errors after it sends data
to the isapi filter?

Charlie

> -----Original Message-----
> From: Cox, Charlie [mailto:ccox@cincom.com]
> Sent: Thursday, October 18, 2001 10:50 AM
> To: 'tomcat-user@jakarta.apache.org'
> Subject: RE: cancelled request
> 
> 
> my problem is that I can't distinguish a valid request from a 
> cancelled one.
> Tomcat in some instances stops my servlet exeution and in 
> others lets it go
> as if I didn't cancel.
> There doesn't seem to be a time difference between 
> downloading 50MB and the
> time it would have taken to complete the download had I not clicked
> 'cancel'.
> 
> I would have expected the socket to be closed and an IO 
> exception to be
> thrown in my servlet - but if the servlet just stops as it 
> sometimes does,
> that's ok too.
> 
> Charlie
> 
> > -----Original Message-----
> > From: Barry White [mailto:barrywhite@charter.net]
> > Sent: Wednesday, October 17, 2001 5:50 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Re: cancelled request
> > 
> > 
> > I have never done anything like that but I was thinking you 
> > could use some
> > kind of timeout in your servlet.  Try doing this in your 
> > while loop.  You
> > could also check bytesread and make sure it is changing.
> > 
> > hope this helps,
> > Barry
> > ----- Original Message -----
> > From: "Cox, Charlie" <cc...@cincom.com>
> > To: <to...@jakarta.apache.org>
> > Sent: Wednesday, October 17, 2001 4:32 PM
> > Subject: cancelled request
> > 
> > 
> > > I didn't see anything about this in the archives, so 
> > hopefully someone can
> > > help me out here.
> > >
> > > TC 3.2.1/IIS 5/W2K
> > > I am using a servlet to serve a large file (50MB) and 
> > everything works
> > fine
> > > if it completes as requested. But if the user clicks 
> 'cancel', I get
> > > different results from Tomcat. Sometimes the servlet stops 
> > running where
> > it
> > > is, as if the thread is interrupted, while other times it 
> continues
> > running
> > > like nothing happened. In the both cases the download box 
> > disappears from
> > > the browser. Netscape 6.1,4.7 and IE 5.5 all act the same 
> > way. (IE 5.0 has
> > a
> > > problem here, but I have other problems with it too).
> > >
> > > here's the code in my servlet providing the file
> > >
> > > resp.setContentType("application/octet-stream; 
> name=somefile.exe;");
> > > resp.setHeader("Content-Disposition",
> > "attachment;filename=somefile.exe;");
> > > resp.setHeader("Content-Length", 
> String.valueOf(filelength) + ";");
> > >
> > > InputStream isDownload;
> > > isDownload = getServletContext().getResourceAsStream(filename);
> > > BufferedInputStream bisDownload = new
> > BufferedInputStream(isDownload,2048);
> > > BufferedOutputStream bosDownload = new
> > > BufferedOutputStream(resp.getOutputStream());
> > > byte[] buff = new byte[2048];
> > > int bytesRead;
> > >
> > > while(-1 != (bytesRead = bisDownload.read(buff, 0, buff.length)))
> > > {
> > > bosDownload.write(buff, 0, bytesRead);
> > > }
> > > bosDownload.close();
> > > bisDownload.close();
> > >
> > >
> > > The reason that this is an issue is that I send an email 
> > upon completion
> > of
> > > this download, and it shouldn't be sent if the user clicks 
> > 'cancel' but it
> > > is being sent when the servlet continues processing. I've 
> > also wrapped
> > this
> > > code is a try/catch and no exception/error is ever thrown.
> > >
> > > Charlie
> > >
> > 
>