New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No idle timeout exception when dispatch is delayed #2081
Comments
Debug shows the timeout calling onFail in the fillInterest and there is a ReadCB pending, but it does not appear to actually get called?
@sbordet thoughts? |
Can that - the callback does get called, but just closes the connection. But an IOException should still be returned to the application??? |
The problem is that this test request sends absolutely no content and the HttpConfiguration is in the default delayDispatchUntilContent mode. So the request is not even dispatched to the application yet, so it has not even started reading, thus no chance to throw an IOException. If I added the following line while setting up the server:
the test works as expected. So we have to consider what is the correct handling of an IdleTimeout when in DelayDispatchUntilContent mode. Currently we treat it exactly as a timeout within the headers, so it is as if the request never actually arrived. This might be a little bit wrong, but it might be a reasonable price to pay for this optimization mode. I'll review the code and see if there is an opportunity for the request to be dispatched with the HttpInput already in a timeout failed state.... @sbordet thoughts? |
Delegate the readtimeout handling to HttpChannel so that a delayed dispatch can be ended. Signed-off-by: Greg Wilkins <gregw@webtide.com>
The @gregw I think it would be strange for a request to be dispatched after the idle timeout with an already failed |
@gregw, we already have a test case that tests idle timeout with So that test really encodes the fact that the Also @gregw, I don't think commit 0706e53 is right, as it only addresses HTTP/1.1. |
@gregw, we need to discuss whether it's okay to call the application with a failed One can see such requests as an attack and deem them not viable to be dispatched to the application (thus consuming a thread, and possibly have other side effects such as calling a third party service, starting to write the response, etc.) So yes it's a behavioral change from 9.2.x, but I'm slightly inclined to think it's a better behavior although I recon there are pros in dispatching too (for example, I would close and discard #2083 until we have decided what is the right behavior. |
@sbordet I think it is strange for an optimisation to change the outcome. Without delayed dispatch a request sent without its body will invoke the application and be logged as a request. With delayed dispatch such a request not logged and does not invoke the application. I don't see this as anymore of an attack then sending 1 byte of the content and then pausing. So I think the behaviour is right. However #2083 is just my initial attempt to see how difficult it may be. As I said, it doesn't consider the other transports. So if there is a better place to implement it that is not transport specific, then I'm definitely happy to redo. Perhaps an alternate solution should be to only delay dispatch for a short period of time - perhaps even user configurable? But I'm not really keen on adding more timers - even cyclic ones. |
I don't understand your comments about They are different methods with different semantics. Anyway, I don't think this is a high priority, so let's wait until we can hangout before discussing further... unless one of us has an idea about how/where to do this that is common to all transports |
Now using HttpInput.onIdleTimeout() to fail the HttpInput, and then dispatching the request in case it has not been dispatched yet. This ensure consistent behavior independently of the value of HttpConfiguration.delayDispatchUntilContent. Fixed for both HTTP/1.1 and HTTP/2. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@gregw I agree that we should dispatch with an already failed |
Added tests for non-blocking reads. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Issue #2081 No idle timeout exception when dispatch is delayed * Delegate the readtimeout handling to HttpChannel so that a delayed dispatch can be ended. * Added unit test for delayed dispatch idle * Now using HttpInput.onIdleTimeout() to fail the HttpInput, and then dispatching the request in case it has not been dispatched yet. This ensure consistent behavior independently of the value of HttpConfiguration.delayDispatchUntilContent. * Fixed for both HTTP/1.1 and HTTP/2. * Added tests for non-blocking reads. Signed-off-by: Greg Wilkins <gregw@webtide.com> Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
how to edit the test case and this exception thrown in HttpOutput?? |
@hchengqiang please open a new issue and detail exactly what's your problem. Why you want to "edit test case"? Explain in the new issue what you are doing, what's the exact Jetty version and configuration, what do you expect and what happens instead. |
Reported by Daniel Gredler djgredler@gmail.com
The following test indicates that the idle Timeout is not throwing an IOException?
The text was updated successfully, but these errors were encountered: