Bug 1856356 - tox hangs for a minute in mock without --enable-network, even with very basic invocations
Summary: tox hangs for a minute in mock without --enable-network, even with very basic...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: pyproject-rpm-macros
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-13 13:01 UTC by Miro Hrončok
Modified: 2020-07-21 20:45 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-21 20:45:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github tox-dev tox issues 1615 0 None closed RFE: Use a HOSTNAME environment variable instead of socket.getfqdn() in ResultLog 2020-07-21 20:45:40 UTC
Github tox-dev tox pull 1616 0 None closed Use a HOSTNAME environment variable instead of socket.getfqdn() in ResultLog 2020-07-21 20:45:41 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.