[New-bugs-announce] [issue31257] importlib race condition

STINNER Victor report at bugs.python.org
Tue Aug 22 08:26:54 EDT 2017


New submission from STINNER Victor:

While stressing the system to get system load of at least 5 (I have 4 logical CPUs), I got an import error whereas the module exists.

See recent changes to fix race conditions in importlib:

* bpo-30891: commit e72b1359f81d1dd42bd8a5c5cc2b3928b74f8023
* bpo-30891: commit 4f9a446f3fb42f800e73cd9414dd1eccb3ca4fa7
* bpo-31070: commit 9b0d1d647e3d2ec9d299e5c9f49b02fbbb810a5a
* bpo-30814: commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0
* ...

I used my system_load.py script to stress my Linux:
https://github.com/haypo/misc/blob/master/bin/system_load.py


haypo at selma$ ./python -m test -r  --randseed=7323369 -R 3:3 -j2 -m test.test_robotparser.PasswordProtectedSiteTestCase.testPasswordProtectedSite test_robotparser  test_robotparser  test_robotparser  test_robotparsertest_robotparser  test_robotparser  test_robotparser  test_robotparser
Using random seed 7323369
Run tests in parallel using 2 child processes
0:00:01 load avg: 9.05 [1/7] test_robotparser passed
beginning 6 repetitions
123456
......
0:00:01 load avg: 9.05 [2/7] test_robotparser passed
beginning 6 repetitions
123456
......
0:00:02 load avg: 10.33 [3/7] test_robotparser passed
beginning 6 repetitions
123456
......
0:00:02 load avg: 10.33 [4/7] test_robotparser passed
beginning 6 repetitions
123456
......
0:00:03 load avg: 10.33 [5/7/1] test_robotparsertest_robotparser failed
test test_robotparsertest_robotparser crashed -- Traceback (most recent call last):
  File "/home/haypo/prog/python/master/Lib/test/libregrtest/runtest.py", line 163, in runtest_inner
    the_module = importlib.import_module(abstest)
  File "/home/haypo/prog/python/master/Lib/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'test.test_robotparsertest_robotparser'
0:00:03 load avg: 10.33 [6/7/1] test_robotparser passed
beginning 6 repetitions
123456
......
0:00:04 load avg: 10.33 [7/7/1] test_robotparser passed
beginning 6 repetitions
123456
......
6 tests OK.

1 test failed:
    test_robotparsertest_robotparser

Total duration: 4 sec
Tests result: FAILURE

----------
messages: 300686
nosy: brett.cannon, eric.snow, haypo, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
status: open
title: importlib race condition

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31257>
_______________________________________


More information about the New-bugs-announce mailing list