Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335681 - Improve ChannelEndPoint.close() to avoid spinning
Summary: Improve ChannelEndPoint.close() to avoid spinning
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 7.2.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.2.x   Edit
Assignee: Simone Bordet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-28 07:58 EST by Simone Bordet CLA
Modified: 2011-01-28 08:38 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.