Skip to content

test_logging hangs if /etc/hosts only aliases "localhost" to ::1 #73458

Closed

Description

@phantal
mannequin
BPO 29272
Nosy @vstinner, @KMiNT21

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2017-01-14.01:37:00.339>
labels = ['type-bug', 'tests']
title = 'test_logging hangs if /etc/hosts only aliases "localhost" to ::1'
updated_at = <Date 2018-07-02.13:32:07.214>
user = 'https://bugs.python.org/phantal'

bugs.python.org fields:

activity = <Date 2018-07-02.13:32:07.214>
actor = 'vstinner'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Tests']
creation = <Date 2017-01-14.01:37:00.339>
creator = 'phantal'
dependencies = []
files = []
hgrepos = []
issue_num = 29272
keywords = []
message_count = 3.0
messages = ['285452', '318266', '320881']
nosy_count = 3.0
nosy_names = ['vstinner', 'phantal', 'KMiNT21']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue29272'
versions = ['Python 3.6']

Linked PRs

Activity

  1. phantal commented on Jan 14, 2017

    phantalmannequin
    MannequinAuthor

    On some of the linux boxes on our (air-gapped, if that matters) network it looks like some of them were mis-configured and their /etc/hosts file looks something like this:

    $ cat /etc/hosts
    127.0.0.1 snoopy.the.internal.domain snoopy localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

    ... whereas for other linux machines not exhibiting this problem:

    $ cat /etc/hosts
    127.0.0.1 woodstock.the.internal.domain woodstock localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

    It appears this is causing test_logging to hang while running SocketHandlerTest.

    Unfortunately I don't have administrative privileges so I'm not able to prove I'm right. I only have circumstantial evidence, but no machine I tested (about 20 machines) contradicts what I stated above.

  2. added
    testsTests in the Lib/test dir
    type-bugAn unexpected behavior, bug, or error
    on Jan 14, 2017
  3. KMiNT21 commented on May 31, 2018

    KMiNT21mannequin
    Mannequin

    The same bug for me:
    3.6.5 and 3.6.4 -hangs on test_logging forever.

    Thanks to this report - I've commented some lines in /etc/host
    and after 'test_logging' passed OK!

  4. vstinner commented on Jul 2, 2018

    @vstinner
    Member

    I confirm the issue. test_logging hangs if the resolution of the hostname fails with a timeout.

    I worked around the issue by adding my hostname to /etc/hosts.

  5. transferred this issue fromon Apr 10, 2022
  6. serhiy-storchaka commented on Jul 22, 2026

    @serhiy-storchaka
    Member

    Should be fixed by #154491.

  7. added a commit that references this issue on Jul 24, 2026
  8. added 3 commits that reference this issue on Jul 24, 2026
  9. added a commit that references this issue on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions