Bug 1856356

Summary: tox hangs for a minute in mock without --enable-network, even with very basic invocations
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: pyproject-rpm-macrosAssignee: Miro Hrončok <mhroncok>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fge, itamar, lbalhar, mhroncok, mrunge, pviktori, python-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-21 20:45:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miro Hrončok 2020-07-13 13:01:50 UTC
I've tried various mock versions we ship and I couldn't find a version where this doesn't happen. 3.14 and 3.15 and 3.16 seem to be affected.


To reproduce, have this tox.ini in an empty directory:

[tox]
envlist = py39


And run from within mock: time tox -l


$ mock -r fedora-rawhide-x86_64 shell
...
<mock-chroot> sh-5.0# time tox -l
py39

real	0m56.269s
user	0m0.199s
sys	0m0.015s


$ mock -r fedora-rawhide-x86_64 shell --enable-network
...
<mock-chroot> sh-5.0# time tox -l
py39

real	0m2.213s
user	0m0.200s
sys	0m0.024s



Note that tox -l should not create any environments nor download any packages from the network :/



This slows down pyproject-rpm-macros/tox-current-env spec files for up to 2 minutes when built in mock. I cannot wrap my head around this and would like to debug what connection it makes.

Comment 1 Miro Hrončok 2020-07-13 19:25:59 UTC
I've managed to debug this with https://unix.stackexchange.com/a/503217/196399 (running the command from outside mock).

There is a dns query to my hostname, tox calls socket.getfqdn().


https://github.com/tox-dev/tox/blob/3.16.1/src/tox/logs/result.py#L24


I've manged to reproduce the hang with:

<mock-chroot> sh-5.0# python3 -c 'import socket; print(socket.getfqdn())'

Comment 2 Miro Hrončok 2020-07-15 10:21:01 UTC
Tox 3.17+ has a way to workaround this. Assigning to pyproject macros to use the workaround.