hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Potapov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HTTPCLIENT-1497) Allow to enable SO_LINGER option with zero timeout
Date Tue, 15 Apr 2014 16:54:19 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Dmitry Potapov updated HTTPCLIENT-1497:

    Attachment: httpclient-enable-linger.patch

Please, consider attached patch as a fix for this issue

> Allow to enable SO_LINGER option with zero timeout
> --------------------------------------------------
>                 Key: HTTPCLIENT-1497
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1497
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.3.3
>            Reporter: Dmitry Potapov
>         Attachments: httpclient-enable-linger.patch
> According to http://docs.oracle.com/javase/8/docs/api/java/net/StandardSocketOptions.html#SO_LINGER
linger option is disabled by default. Currently if SocketConfig.soLinger is set to zero (default
value is -1), then Socket.setSoLinger(false, 0) will be called, so linger will be disabled,
which is undesirable. Zero SO_LINGER timeout is the essential feature for HttpClient, without
it we will fall into one of two options:
> 1. With disabled SO_LINGER all system sockets can fall into TIME_WAIT status and client
will stuck
> 2. With enabled non-zero SO_LINGER client will wait up to 1 second at AbstractConnPool.getPoolEntryBlocking
(Line 230) while closing expired connections under lock (this lock is already held by PoolingEntryFuture.get(),
so there is no quick fix to release this lock for other threads)
> I had encountered both of these issues on live systems.
> I understand that this change will break backward compatibility of config interpretation,
but can we have this in 4.4?

This message was sent by Atlassian JIRA

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

View raw message