This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_logging hangs if /etc/hosts only aliases "localhost" to ::1
Type: behavior Stage:
Components: Tests Versions: Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: KMiNT21, phantal, vstinner
Priority: normal Keywords:

Created on 2017-01-14 01:37 by phantal, last changed 2022-04-11 14:58 by admin.

Messages (3)
msg285452 - (view) Author: Brian Vandenberg (phantal) Date: 2017-01-14 01:36
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 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 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.
msg318266 - (view) Author: KMiNT21 (KMiNT21) Date: 2018-05-31 08:32
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!
msg320881 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-02 13:32
I confirm the issue. test_logging hangs if the resolution of the hostname fails with a timeout.

I worked again the issue by adding my hostname to /etc/hosts.
Date User Action Args
2022-04-11 14:58:42adminsetgithub: 73458
2018-07-02 13:32:07vstinnersetnosy: + vstinner
messages: + msg320881
2018-05-31 08:32:48KMiNT21setnosy: + KMiNT21
messages: + msg318266
2017-01-14 01:37:00phantalcreate