[New-bugs-announce] [issue46625] timeout option of socket.create_connection is not respected

Nicolas SURRIBAS report at bugs.python.org
Thu Feb 3 09:18:19 EST 2022

New submission from Nicolas SURRIBAS <nicolas.surribas at gmail.com>:

When passing to socket.create_connection a timeout option above (approximately) 127 seconds, the timeout is not respected. 

Code to reproduce the issue :

import socket
from time import monotonic

start = monotonic()
    socket.create_connection(("", 21), 300)
except Exception as exception:

print(monotonic() - start)

Output at execution:

[Errno 110] Connection timed out

Expected behavior would be that the "Connection timed out" exception is raised after 300 seconds, as given in argument, not 129.

Observed with Python 3.9.1

components: IO
messages: 412443
nosy: Nicolas SURRIBAS
priority: normal
severity: normal
status: open
title: timeout option of socket.create_connection is not respected
type: behavior
versions: Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list