[undertow-dev] Setting/handling request timeouts

Bill O'Neil bill at dartalley.com
Wed Aug 20 07:55:17 EDT 2014


I am specifically looking for a way to timeout/kill a blocking task that is
taking too long to return.  Is this something that should be handled when
dispatching to the underlying executor?

Bill


On Wed, Aug 20, 2014 at 1:46 AM, Stuart Douglas <sdouglas at redhat.com> wrote:

> This is an area that we are looking to improve. In particular I am looking
> into adding more options in this area, to give more control over when
> timeouts are applied.
>
> For example I am thinking something like:
>
> NO_REQUEST_TIMEOUT - How long the server should wait between requests
> PARSE_TIMEOUT - the maximum amount of time that should be spent parsing a
> HTTP request
> READ_TIMEOUT - When reading a request entity the maximum idle timeout
>
> I'm not sure if this covers all the use cases though.
>
> Stuart
>
>
> Bill O'Neil wrote:
>
>> I have been having trouble figuring out how to set request timeouts and
>> how to handle them.
>>
>> I have been messing around with the following.
>>
>> Undertow server = Undertow.builder()
>>      .addHttpListener(8080, "localhost")
>>      .setSocketOption(UndertowOptions.IDLE_TIMEOUT, 1000)
>>      .setSocketOption(Options.READ_TIMEOUT, 1000)
>>      .setSocketOption(Options.WRITE_TIMEOUT, 1000)
>>
>> When setting a HttpHandler that sleeps this will return an empty reply
>> from server.
>>
>> curl -v localhost:8080
>> * Adding handle: conn: 0x7f81a900ee00
>> * Adding handle: send: 0
>> * Adding handle: recv: 0
>> * Curl_addHandleToPipeline: length: 1
>> * - Conn 0 (0x7f81a900ee00) send_pipe: 1, recv_pipe: 0
>> * About to connect() to localhost port 8080 (#0)
>> *   Trying ::1...
>> *   Trying 127.0.0.1...
>> * Connected to localhost (127.0.0.1) port 8080 (#0)
>>  > GET / HTTP/1.1
>>  > User-Agent: curl/7.30.0
>>  > Host: localhost:8080
>>  > Accept: */*
>>  >
>> * Empty reply from server
>> * Connection #0 to host localhost left intact
>> curl: (52) Empty reply from server
>>
>> 1. What is the proper way to handle time outs?
>> 2. Is it possible to set different timeouts per HttpHandler?
>>
>> Thanks,
>> Bill
>>
>> _______________________________________________
>> undertow-dev mailing list
>> undertow-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/undertow-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20140820/25ca12cc/attachment.html 


More information about the undertow-dev mailing list