Skip to content

Timeout is doubled - socket.create_connection() #123793

@j-schulz

Description

@j-schulz

Bug report

Bug description:

import socket
import time
start = time.time()
sock = socket.create_connection(
    address=("foobar", 10000),
    timeout=5)
print(time.time() - start)

No matter what value you specify as a timeout, the timeout is always doubled. If you specify 5 seconds, an exception will only be thrown after 10 seconds; if you specify 10 seconds, then only after 20.

Tested on Debian 12 with Python 3.11.

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions