0

I'm starting an embedded Jetty Server and using SelectChannelConnector for this. For legacy reasons I have to use Jetty 6.

I'm unable to correctly simulate a connection close from the Server's end. On setting the connector.setMaxIdleTime to a very low value of around 20 ms, it still doesn't fail .

On the client side I'm reading a stream of data from the Jetty Server.

Note If I set the setMaxIdleTime value to around 10ms. The connection is correctly closed and I get an "unexpected EOF from the Server", but this happens when The client side is parsing http headers. What I want to do is simulate the same behavior when I'm reading the actual content.

RD.
  • 300
  • 4
  • 12

1 Answers1

0

For legacy reasons, the best way to do this is to write your own Connector to implement that. (even projects that still rely on Jetty 6, such as GWT/GAE, have done that. sadly, none of those custom connectors are open source)

On Jetty 6, maxIdleTime really just translates to Socket.setSoTimeout(int), which really only works for Blocking behaviors. For Jetty 7, and the focus on async everything, that definition has changed greatly, so much so that maxIdleTime as a configurable was even renamed to represent the new reality. See past answer to Stackoverflow question: When does maxIdleTime trigger?

CAUTION: Jetty 6 was EOL in 2010, and is no longer fit or safe to use on the open internet due to unfixed vulnerabilities. not even putting it behind a load balancer, proxy, nginx, or apache httpd will help. (it's ok to use in highly controlled and limited environments).

At least upgrade to Jetty 7, it has the same servlet revision, same JVM requirements, as Jetty 6, along with idle timeout support, and wont be EOL till the end of 2014.

Community
  • 1
  • 1
Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
  • Thanks Joakim Erdfelt. I'm hitting this problem in an production environment and was trying to reproduce on my local setup. – RD. Oct 11 '14 at 03:38
  • Good luck, and you'll probably want to be extra clear on what you expect your "simulated maxIdletime" actually does. As the definition you have in mind, and the one that is associated with Socket.setSoTimeout(int), might not be aligned (a common confusion back the pre jetty-7 days) – Joakim Erdfelt Oct 11 '14 at 03:44