- From: Anselm Baird_Smith <abaird@www43.inria.fr>
- Date: Mon, 6 Jan 1997 13:15:32 +0100 (MET)
- To: orjan@spinne.ip.lu
- Cc: www-jigsaw@www10.w3.org
orjan@spinne.ip.lu writes:
> Hi there!
>
> I'v been jusing the Jigsaw class framework for some time now in my
> own little HTTP server project, but lately I'v run into some bizarre
> problems (and I have a feeling that my problems might not be linked
> to the Jigsaw classes but to bugs in Java itself, but anyway!!)
>
> Here's the situation (very simplified):
>
> I have a normal sever situation and I'm using the w3.www.MimeParser
> class to parse the client request (I should also point out that this
> is in a single threaded sceeenarion; handling of the request is done
> directly after and in the same thread as receiving the connection).
>
> try {
> clisock = servsock.accept();
> } catch (IOException ex) {
> // Handle Exception ...
> }
>
> try {
> in = new DataInputStream(clisock.getInputStream());
> out = new PrintStream(clisock.getOutputStream());
> } catch (IOException ex) {
> // Handle Exception ...
> }
>
> try {
> MimeClientFactory factory = new MimeClientFactory();
> MimeParser parser = new MimeParser(in, factory);
> ClientRequest req = (ClientRequest) parser.parse();
> } catch (IOException ex) {
> // Handle Exception ...
> } catch (MimeParserException ex) {
> // Handle Exception ...
> }
>
> MimeClientFactory implements MimeParserFactory and ClientRequest
> is basically a HttpRequestMessage.
>
> Now, when I use a Netsacpe browser and resize a page retrived from my
> simplistic server, Netscape generates a request that in the best case
> generates a HttpParserException (End Of File) in my server. In the
> worst case the whole excution is blocked infinitely in the request
> parsing step WITHOUT generation any exceptions or errors!! This is
> really bad news in a single threaded server scheme! In a multi-
> threaded server scheme (like Jigsaw) it might be bad news as well
> since it might create zombie threads.
I guess you are not handling persistent connections correctly. If, for
example, you don't tel netscape to close the connection, by *not*
sending a 'Connection: keep-alive' header, then it will probably reuse
the connection.
Another possible problem is if netscape closes the connection (which
it has the right to do), and then tries to reopen a fresh one.
In summary: is the above code the real code, or do you loop and handle
multiple requests on the same connection ?
Anselm.
Received on Monday, 6 January 1997 07:15:38 UTC