Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 7.0.0pre1
-
Fix Version/s: None
-
Component/s: Bayeux
-
Labels:None
-
Environment:linux 2.6
-
Number of attachments :
Description
I wrote a sample code to see how jetty close the socket. but I found that jetty won't close the socket even after the client closed the peer-socket. this is my source code, very simple:
public static void main(String[] args) throws Exception {
Handler handler = new AbstractHandler() {
public void handle(String target, HttpServletRequest request,
HttpServletResponse response, int dispatch)
throws IOException, ServletException {
Continuation cont = ContinuationSupport.getContinuation(
request, null);
if(cont.isPending())
else
{ cont.suspend(0); } }
};
Server server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(8080);
server.setConnectors(new Connector[]
);
server.setHandler(handler);
server.start();
}
i can reproduce this bug by following way:
1. open web browser to access http://locahost:8080/hello . as the first time, it is suspended by continuation, and wait for being resumed.
2. close the web browser to simulate the user's leaving.
3. run command "nestat -tanp | grep 8080" to watch the tcp connection:
tcp 0 0 127.0.0.1:43465 127.0.0.1:8080 FIN_WAIT2 -
tcp6 0 0 :::8080 :::* LISTEN 22866/java
tcp6 1 0 127.0.0.1:8080 127.0.0.1:43465 CLOSE_WAIT 22866/java
abviously, CLOSE_WAIT status tells me that the socket is waiting for being closed. I think, since i have closed the web browser, the socket of server should be close at once.
Issue Links
- supercedes
-
JETTY-593
the pending continuation won't be resumed even after connection is closed
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Greg Wilkins [ gregw ] |
| Affects Version/s | 6.1.10 [ 14161 ] | |
| Affects Version/s | 7.0.0pre1 [ 14208 ] | |
| Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
| Assignee | Greg Wilkins [ gregw ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Won't Fix [ 2 ] |
Some info: this is really an artifact of the implementation. In jetty6 after a suspend(), the request has to be redispatched via a call to either timeout() or resume() before it can notice that the socket has closed. In jetty7, which implements the servlet 3 api, if you are writing to the response whilst suspended (which is a new feature), then you can see that the client socket has closed. Being able to notice that the socket has closed if you are NOT doing IO would be nice to have, but is difficult to implement.
We'll keep this issue open until we think of a way of doing it or give up
regards
Jan