You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Asankha C. Perera (JIRA)" <ji...@apache.org> on 2011/06/27 06:04:47 UTC

[jira] [Created] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Improve Socket Timeout Handling support when connections are being kept alive and re-used
-----------------------------------------------------------------------------------------

                 Key: HTTPCORE-261
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
             Project: HttpComponents HttpCore
          Issue Type: Improvement
          Components: HttpCore NIO
    Affects Versions: 4.1.1
            Reporter: Asankha C. Perera
            Assignee: Asankha C. Perera
            Priority: Minor
             Fix For: 4.1.2


This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily

The problem can be described against v4.1.1 as follows:
1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 

See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055586#comment-13055586 ] 

Oleg Kalnichevski commented on HTTPCORE-261:
--------------------------------------------

My bad. Fixed NPE in AbstractIOReactor#timeoutCheck. Please re-test.

Oleg

> Improve Socket Timeout Handling support when connections are being kept alive and re-used
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-261
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.1
>            Reporter: Asankha C. Perera
>            Assignee: Asankha C. Perera
>            Priority: Minor
>             Fix For: 4.1.2
>
>         Attachments: HTTPCORE-261-v4.1.x.patch, HTTPCORE-261-v4.2-alpha1.patch
>
>
> This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily
> The problem can be described against v4.1.1 as follows:
> 1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
> 2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
> 3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
> 4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 
> See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asankha C. Perera updated HTTPCORE-261:
---------------------------------------

    Attachment: HTTPCORE-261-v4.2-alpha1.patch

patch for 4.2-alpha1 snapshot (trunk)

> Improve Socket Timeout Handling support when connections are being kept alive and re-used
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-261
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore NIO
>    Affects Versions: 4.1.1
>            Reporter: Asankha C. Perera
>            Assignee: Asankha C. Perera
>            Priority: Minor
>             Fix For: 4.1.2
>
>         Attachments: HTTPCORE-261-v4.1.x.patch, HTTPCORE-261-v4.2-alpha1.patch
>
>
> This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily
> The problem can be described against v4.1.1 as follows:
> 1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
> 2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
> 3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
> 4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 
> See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asankha C. Perera resolved HTTPCORE-261.
----------------------------------------

    Resolution: Fixed

Thanks Oleg! the last commit fixes the code again

> Improve Socket Timeout Handling support when connections are being kept alive and re-used
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-261
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.1
>            Reporter: Asankha C. Perera
>            Assignee: Asankha C. Perera
>            Priority: Minor
>             Fix For: 4.1.2
>
>         Attachments: HTTPCORE-261-v4.1.x.patch, HTTPCORE-261-v4.2-alpha1.patch
>
>
> This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily
> The problem can be described against v4.1.1 as follows:
> 1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
> 2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
> 3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
> 4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 
> See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-261:
---------------------------------------

    Issue Type: Bug  (was: Improvement)

Asankha

I came up with a solution that does not require API changes and straightens the way timeouts are handled in general. Please review the fix in the trunk. If that resolves the issue for you, I'll merge the changes up to the 4.1.x branch.

Oleg

> Improve Socket Timeout Handling support when connections are being kept alive and re-used
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-261
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.1
>            Reporter: Asankha C. Perera
>            Assignee: Asankha C. Perera
>            Priority: Minor
>             Fix For: 4.1.2
>
>         Attachments: HTTPCORE-261-v4.1.x.patch, HTTPCORE-261-v4.2-alpha1.patch
>
>
> This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily
> The problem can be described against v4.1.1 as follows:
> 1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
> 2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
> 3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
> 4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 
> See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asankha C. Perera updated HTTPCORE-261:
---------------------------------------

    Attachment: HTTPCORE-261-v4.1.x.patch

Patch for 4.1.x branch

> Improve Socket Timeout Handling support when connections are being kept alive and re-used
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-261
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore NIO
>    Affects Versions: 4.1.1
>            Reporter: Asankha C. Perera
>            Assignee: Asankha C. Perera
>            Priority: Minor
>             Fix For: 4.1.2
>
>         Attachments: HTTPCORE-261-v4.1.x.patch
>
>
> This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily
> The problem can be described against v4.1.1 as follows:
> 1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
> 2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
> 3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
> 4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 
> See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055564#comment-13055564 ] 

Asankha C. Perera commented on HTTPCORE-261:
--------------------------------------------

Oleg

I am seeing some unit test failures in my code with the stack trace:
Caused by: java.lang.NullPointerException
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.timeoutCheck(AbstractIOReactor.java:488)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.validate(BaseIOReactor.java:205)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:282)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:542)
        ... 1 more

I am yet to dive deep into this, but thought you may be able to quickly determine the cause

thanks
asankha



> Improve Socket Timeout Handling support when connections are being kept alive and re-used
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-261
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.1
>            Reporter: Asankha C. Perera
>            Assignee: Asankha C. Perera
>            Priority: Minor
>             Fix For: 4.1.2
>
>         Attachments: HTTPCORE-261-v4.1.x.patch, HTTPCORE-261-v4.2-alpha1.patch
>
>
> This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily
> The problem can be described against v4.1.1 as follows:
> 1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
> 2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
> 3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
> 4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 
> See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-261) Improve Socket Timeout Handling support when connections are being kept alive and re-used

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055703#comment-13055703 ] 

Oleg Kalnichevski commented on HTTPCORE-261:
--------------------------------------------

Cool. Changes ported to the 4.1.x branch as well.

Oleg

> Improve Socket Timeout Handling support when connections are being kept alive and re-used
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-261
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-261
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.1.1
>            Reporter: Asankha C. Perera
>            Assignee: Asankha C. Perera
>            Priority: Minor
>             Fix For: 4.1.2
>
>         Attachments: HTTPCORE-261-v4.1.x.patch, HTTPCORE-261-v4.2-alpha1.patch
>
>
> This is an enhancement request to improve the support to keep connections alive, and re-use them effectively without letting them timeout unnecessarily
> The problem can be described against v4.1.1 as follows:
> 1. We establish an outgoing connection and set the socket timeout to 5 seconds (Time = t0 )
> 2. After receiving the response, we want to keep the socket open for reuse for 30 seconds, and we update the timeout (Time = t1)
> 3. After 6 seconds since #2 above, we get an opportunity to reuse this connection, and again we set the socket timeout to 5 seconds
> 4. Almost immediately, the BaseIOReactor timeout check most definitely notices that the time the socket was last used (t1) is over 5 seconds from the current time, and times out the socket 
> See http://markmail.org/message/zgnrquosjahqog6f for more details

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org