Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

socket.getservbyname() in _ipaddr_info could block #422

@dwfreed

Description

@dwfreed

#354 added a call to socket.getservbyname() in _ipaddr_info() to resolve service names into port numbers. However, local system configuration could result in getservbyname() blocking for some time, especially if the system is configured to query something like NIS or use the old hesiod protocol to look up this information. Even in the default configuration, if the disk holding /etc/services is unhappy with life, attempting to read /etc/services could take some time. This would bring the whole event loop to a grinding halt. getaddrinfo() (usually) will handle non-numeric port strings so long as AI_NUMERICSERV is not used, so it would probably be best to just let getaddrinfo() handle it.

(While looking into this, I discovered the Python getservbyname() implementation is not thread-safe, but that's a different bug...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions