I see the same problem with my client too. However, I don't see the
issue when I use a client using Jakarta HTTP client. I'm still looking
into this. Any help will, of course be welcome and delightfully
devoured.


This is not really the same bug report, but something to think about
when you're working with events. Also, it may have a clue I'm missing.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42198

Also, check with the trunk to make sure you're able to reproduce your
defect.

Praveen

-----Original Message-----
From: Sebastiaan van Erk [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 26, 2007 2:07 PM
To: Tomcat Users List
Subject: how to close a comet request outside of an event?

Hi,

I the following Comet question; due to a server event (not a comet 
event), I want to write some data to a client request and finish the 
request. Currently I write the data and then call OutputStream.close() 
on the response output stream. This seems to work, except that it takes 
a long time before I get an END event for that request. On the client 
this causes the EOF to the request input stream to arrive very late. 
This is a problem, because both the server and client are handling so 
many requests that I run out of file descriptors and get the following 
exception (on the server):

Apr 26, 2007 10:28:23 AM org.apache.tomcat.util.net.NioEndpoint$Acceptor
run
SEVERE: Socket accept failed
java.io.IOException: Too many open files
    at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
    at 
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:1
45)
    at 
org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:117
7)
    at java.lang.Thread.run(Thread.java:619)

Note: I'm running the client and server on the same machine, but the 
client does not get any "Too many open files" exceptions (it does not 
get any exceptions at all), so I'm assuming the process limit of tomcat 
is reached, suggesting that tomcat is not closing the request sockets 
until the END event...

If I close the request on the client side before I get the EOF (-1) in a

read I don't get the Too many open files problem and generally get the 
END event immediately on the server side, but I sporadically get 
NullPointerExceptions and AsynchronousCloseExceptions and 
ClosedChannelExceptions on the server side in the OutputStream.close() 
method. I figure the proper method is for the client tp wait for the 
server to say "the request is done" (by waiting for the EOF) before 
closing thesocket, but how do I make sure it gets closed immediately on 
the server side if I'm not in a comet event?

Regards,
Sebastiaan

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to