classification
Title: Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module
Type: enhancement Stage: commit review
Components: Library (Lib) Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: JelteF, Omar Sandoval, martin.panter, ned.deily, pitrou, python-dev, serhiy.storchaka, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2016-02-03 08:54 by Omar Sandoval, last changed 2017-03-31 16:36 by dstufft. This issue is now closed.

Files
File name Uploaded Description Edit
socket_tcp_options.patch Omar Sandoval, 2016-02-03 08:54 review
socket_doc.patch vstinner, 2016-11-29 17:26 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017-03-31 16:36
Messages (16)
msg259460 - (view) Author: Omar Sandoval (Omar Sandoval) * Date: 2016-02-03 08:54
The socket module is missing a couple of TCP socket options: TCP_CONGESTION was added to Linux in v2.6.13 and TCP_USER_TIMEOUT was added in v2.6.37. These should be exposed.
msg281100 - (view) Author: Jelte Fennema (JelteF) * Date: 2016-11-18 11:38
Is there any issue in merging this? TCP_USER_TIMEOUT is quite useful, for automatic failover of connections that suddenly died.
msg281997 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2016-11-29 15:44
+1 for this.  The patch looks fine, and there's no need to add any documentation or tests.
msg282001 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-29 15:55
New changeset 674fb9644eaa by Victor Stinner in branch 'default':
Add TCP_CONGESTION and TCP_USER_TIMEOUT
https://hg.python.org/cpython/rev/674fb9644eaa
msg282002 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-29 15:57
@Ned Deily: Would you be ok to add these two constants to Python 3.6? I cannot image any regression if 674fb9644eaa is backported to Python 3.6.

@Serhiy, Yury: Any opinion on the backport?
msg282003 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-29 15:59
Sorry, I missed this issue.

TCP_USER_TIMEOUT is super useful! It helps a lot to detect when a server is down, especially when using keep alive: at kernel level (TCP keepalive) or application level (ex: RabbitMQ heart beat).

Linux default timeout is more something like 15 minutes. A few years ago, it was longer than 2 days :-)
msg282004 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2016-11-29 16:05
Le 29/11/2016 à 16:59, STINNER Victor a écrit :
> 
> TCP_USER_TIMEOUT is super useful!

It is :-)
msg282007 - (view) Author: Omar Sandoval (Omar Sandoval) * Date: 2016-11-29 16:16
Glad to see this finally get in :)
msg282011 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-29 16:33
Shouldn't we add something like versionadded/versionchanged or a mentioning in What's New?
msg282012 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-11-29 16:37
Would be nice to have in 3.6.
msg282017 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-11-29 17:15
OK for 3.6.0rc1 (before it times out)
msg282019 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-29 17:22
New changeset 6d69da76be6a by Victor Stinner in branch '3.6':
Add TCP_CONGESTION and TCP_USER_TIMEOUT
https://hg.python.org/cpython/rev/6d69da76be6a
msg282020 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-29 17:26
Serhiy Storchaka: "Shouldn't we add something like versionadded/versionchanged or a mentioning in What's New?"

Oh right, we did that for other new constants added to Python 3.6 like SO_DOMAIN.

Attached socket_doc.patch documents the additional of the two new constants. It seems like "hg transplant" putted the NEWS entry in the wrong section :-/ The patch also fixes that.
msg285982 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-01-22 02:45
Patch looks good to me.

BTW in Issue 27409 I proposed a patch listing more of these.
msg286076 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2017-01-23 11:30
New changeset ffb2534fcbf1 by Victor Stinner in branch '3.6':
Issue #26273: Document TCP_USER_TIMEOUT and TCP_CONGESTION
https://hg.python.org/cpython/rev/ffb2534fcbf1
msg286077 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-01-23 11:31
> Patch looks good to me.

Oh, I forgot socket_doc.patch! Thanks Serhiy for the reminder and Martin for the review :-) I just pushed the patch.
History
Date User Action Args
2017-03-31 16:36:10dstufftsetpull_requests: + pull_request857
2017-01-23 11:31:12vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg286077
2017-01-23 11:30:18python-devsetmessages: + msg286076
2017-01-22 02:45:11martin.pantersetnosy: + martin.panter
messages: + msg285982
2016-11-29 17:26:59vstinnersetfiles: + socket_doc.patch

messages: + msg282020
2016-11-29 17:22:53python-devsetmessages: + msg282019
2016-11-29 17:15:29ned.deilysetstage: patch review -> commit review
messages: + msg282017
versions: + Python 3.6
2016-11-29 16:37:52yselivanovsetmessages: + msg282012
2016-11-29 16:33:47serhiy.storchakasetmessages: + msg282011
2016-11-29 16:16:23Omar Sandovalsetmessages: + msg282007
2016-11-29 16:05:48pitrousetmessages: + msg282004
2016-11-29 15:59:08vstinnersetmessages: + msg282003
2016-11-29 15:57:15vstinnersetnosy: + ned.deily, vstinner, serhiy.storchaka
messages: + msg282002
2016-11-29 15:55:35python-devsetnosy: + python-dev
messages: + msg282001
2016-11-29 15:44:58pitrousetversions: + Python 3.7, - Python 3.6
nosy: + pitrou

messages: + msg281997

stage: patch review
2016-11-18 11:38:18JelteFsetnosy: + JelteF
messages: + msg281100
2016-02-03 15:15:03yselivanovsetnosy: + yselivanov
2016-02-03 08:54:44Omar Sandovalcreate