Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335681

Summary: Improve ChannelEndPoint.close() to avoid spinning
Product: [RT] Jetty Reporter: Simone Bordet <simone.bordet>
Component: serverAssignee: Simone Bordet <simone.bordet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jetty-inbox
Version: 7.2.2   
Target Milestone: 7.2.x   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Simone Bordet CLA 2011-01-28 07:58:01 EST
It is possible that the server ends up in a spinning situation if the client sends some data and immediately after closes the connection.
The server will catch an exception trying to read, and attempt to close the connection.
However, ChannelEndPoint.close() does a 2 step close: first it shuts down the output then closes the channel.
If the shutdown throws an exception (the client has already closed the connection, so the FIN cannot be sent), then the channel is never closed.
This leaves the server in a state where it tries to write the response because it thinks that the channel is open, spinning.
Comment 1 Simone Bordet CLA 2011-01-28 08:38:00 EST
Added a try/catch block to make sure the channel is closed even if shutdownOutput() throws.