eventlet
eventlet copied to clipboard
AssertionError: Expected 2 post-fork patched threads, got {140737346365248: <_MainThread(MainThread, started 140737346365248)>}
I've ran into a test failure with eventlet 0.33.0 on python 3.9 on the same test as #646, but it seems to be a different failure:
Executing pytestCheckPhase
============================= test session starts ==============================
platform linux -- Python 3.9.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /build/source
collected 700 items / 16 deselected / 684 selected
tests/api_test.py ......... [ 1%]
tests/backdoor_test.py ..s. [ 1%]
tests/convenience_test.py ........... [ 3%]
tests/dagpool_test.py ...................... [ 6%]
tests/db_pool_test.py .....sssssssssssssssssssssssssssssssssssssssssssss [ 14%]
sssssssssssssssssssssssssssssssssss [ 19%]
tests/debug_test.py ......... [ 20%]
tests/env_test.py ..... [ 21%]
tests/event_test.py ....... [ 22%]
tests/green_http_test.py ... [ 22%]
tests/green_profile_test.py . [ 22%]
tests/green_select_test.py . [ 22%]
tests/greendns_test.py ................................................. [ 30%]
.............................. [ 34%]
tests/greenio_test.py ...s......................................... [ 41%]
tests/greenpool_test.py ............................ [ 45%]
tests/greenthread_test.py ....................... [ 48%]
tests/hub_test.py .............s........ [ 51%]
tests/mysqldb_test.py sssssssss [ 53%]
tests/openssl_test.py . [ 53%]
tests/os_test.py . [ 53%]
tests/patcher_psycopg_test.py s [ 53%]
tests/patcher_test.py .................................s........F.. [ 60%]
tests/pools_test.py ............. [ 61%]
tests/queue_test.py ......................... [ 65%]
tests/semaphore_test.py ....... [ 66%]
tests/socket_test.py ....... [ 67%]
tests/ssl_test.py ............... [ 69%]
tests/subprocess_test.py ....... [ 70%]
tests/test__event.py .. [ 71%]
tests/test__greenness.py . [ 71%]
tests/test__refcount.py .. [ 71%]
tests/test__socket_errors.py .... [ 72%]
tests/thread_test.py ...... [ 73%]
tests/timeout_test.py ...... [ 73%]
tests/timer_test.py .. [ 74%]
tests/tpool_test.py .............................. [ 78%]
tests/websocket_new_test.py ..................... [ 81%]
tests/websocket_test.py ........................ [ 85%]
tests/wsgi_test.py ....................................................s [ 92%]
........................ [ 96%]
tests/zmq_test.py ssssssssssssssssssssssss [100%]
=================================== FAILURES ===================================
_________________________ test_fork_after_monkey_patch _________________________
def test_fork_after_monkey_patch():
> tests.run_isolated('patcher_fork_after_monkey_patch.py')
tests/patcher_test.py:521:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/__init__.py:381: in run_isolated
run_python(prefix + path, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = '/build/source/tests/isolated/patcher_fork_after_monkey_patch.py'
env = None, args = None, timeout = 10, pythonpath_extend = None
expect_pass = True
def run_python(path, env=None, args=None, timeout=None, pythonpath_extend=None, expect_pass=False):
new_argv = [sys.executable]
if sys.version_info[:2] <= (2, 7):
new_argv += ['-W', 'ignore:Python 2 is no longer supported']
new_env = os.environ.copy()
new_env.setdefault('eventlet_test_in_progress', 'yes')
src_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if path:
path = os.path.abspath(path)
new_argv.append(path)
new_env['PYTHONPATH'] = os.pathsep.join(sys.path + [src_dir])
if env:
new_env.update(env)
if pythonpath_extend:
new_path = [p for p in new_env.get('PYTHONPATH', '').split(os.pathsep) if p]
new_path.extend(
p if os.path.isabs(p) else os.path.join(src_dir, p) for p in pythonpath_extend
)
new_env['PYTHONPATH'] = os.pathsep.join(new_path)
if args:
new_argv.extend(args)
p = subprocess.Popen(
new_argv,
env=new_env,
stderr=subprocess.STDOUT,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
if timeout is None:
timeout = 10
try:
output, _ = p.communicate(timeout=timeout)
except subprocess.TimeoutExpired:
p.kill()
output, _ = p.communicate(timeout=timeout)
if expect_pass:
sys.stderr.write('Program {0} output:\n---\n{1}\n---\n'.format(path, output.decode()))
assert False, 'timed out'
return '{0}\nFAIL - timed out'.format(output).encode()
if expect_pass:
if output.startswith(b'skip'):
parts = output.rstrip().split(b':', 1)
skip_args = []
if len(parts) > 1:
skip_args.append(parts[1])
raise SkipTest(*skip_args)
ok = output.rstrip() == b'pass'
if not ok:
sys.stderr.write('Program {0} output:\n---\n{1}\n---\n'.format(path, output.decode()))
> assert ok, 'Expected single line "pass" in stdout'
E AssertionError: Expected single line "pass" in stdout
tests/__init__.py:374: AssertionError
----------------------------- Captured stderr call -----------------------------
Program /build/source/tests/isolated/patcher_fork_after_monkey_patch.py output:
---
Traceback (most recent call last):
File "/build/source/tests/isolated/patcher_fork_after_monkey_patch.py", line 49, in <module>
check(2, threading, 'post-fork patched')
File "/build/source/tests/isolated/patcher_fork_after_monkey_patch.py", line 7, in check
assert len(mod._active) == n, 'Expected {} {} threads, got {}'.format(n, tag, mod._active)
AssertionError: Expected 2 post-fork patched threads, got {140737346365248: <_MainThread(MainThread, started 140737346365248)>}
---
=============================== warnings summary ===============================
../../nix/store/n2p8ksinsz771pqhj1sjry4pw1h98lxn-python3.9-nose-1.3.7/lib/python3.9/site-packages/nose/importer.py:12
/nix/store/n2p8ksinsz771pqhj1sjry4pw1h98lxn-python3.9-nose-1.3.7/lib/python3.9/site-packages/nose/importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
from imp import find_module, load_module, acquire_lock, release_lock
eventlet/debug.py:16
/build/source/eventlet/debug.py:16: DeprecationWarning: invalid escape sequence \W
_token_splitter = re.compile('\W+')
tests/pools_test.py:248
/build/source/tests/pools_test.py:248: PytestCollectionWarning: cannot collect test class 'TestTookTooLong' because it has a __init__ constructor (from: tests/pools_test.py)
class TestTookTooLong(Exception):
eventlet/green/http/client.py:55
/build/source/eventlet/green/http/client.py:55: DeprecationWarning: invalid escape sequence \_
"""HTTP/1.1 client library
tests/dagpool_test.py::test_init
/build/source/tests/dagpool_test.py:194: DeprecationWarning: Please use assertEqual instead.
assert_equals(results, dict(a=1, b=2, c=3))
tests/dagpool_test.py::test_init
/build/source/tests/dagpool_test.py:201: DeprecationWarning: Please use assertEqual instead.
assert_equals(results, dict(d=4, e=5, f=6))
tests/dagpool_test.py::test_wait_each_preload
/build/source/tests/dagpool_test.py:219: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each("abc")), dict(a=1, b=2, c=3))
tests/dagpool_test.py::test_wait_each_preload
/build/source/tests/dagpool_test.py:222: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.wait("bc"), dict(b=2, c=3))
tests/dagpool_test.py::test_wait_posted
/build/source/tests/dagpool_test.py:260: DeprecationWarning: Please use assertEqual instead.
assert_equals(gotten,
tests/dagpool_test.py::test_spawn_collision_spawn
/build/source/tests/dagpool_test.py:288: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("a"), None)
tests/dagpool_test.py::test_spawn_collision_spawn
/build/source/tests/dagpool_test.py:296: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("a"), "aval")
tests/dagpool_test.py::test_spawn_multiple
tests/dagpool_test.py::test_spawn_multiple
tests/dagpool_test.py::test_spawn_multiple
tests/dagpool_test.py::test_spawn_multiple
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:327: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get(k), None)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:328: DeprecationWarning: Please use assertEqual instead.
assert_equals(set(pool.keys()), set("abc"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:329: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.items()), dict(a=1, b=2, c=3))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:330: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.running(), 5)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:331: DeprecationWarning: Please use assertEqual instead.
assert_equals(set(pool.running_keys()), set("defgh"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:332: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting(), 1)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:333: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting_for(), dict(h=set("defg")))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:334: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting_for("d"), set())
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:335: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting_for("c"), set())
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:338: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting_for("h"), set("defg"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:344: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("f"), "fval")
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:345: DeprecationWarning: Please use assertEqual instead.
assert_equals(set(pool.keys()), set("abcf"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:346: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.items()), dict(a=1, b=2, c=3, f="fval"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:347: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.running(), 4)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:348: DeprecationWarning: Please use assertEqual instead.
assert_equals(set(pool.running_keys()), set("degh"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:349: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting(), 1)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:350: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting_for("h"), set("deg"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:357: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("e"), "eval")
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:358: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("g"), "gval")
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:359: DeprecationWarning: Please use assertEqual instead.
assert_equals(set(pool.keys()), set("abcefg"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:360: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.items()),
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:362: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.running(), 2)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:363: DeprecationWarning: Please use assertEqual instead.
assert_equals(set(pool.running_keys()), set("dh"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:364: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting(), 1)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:365: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting_for("h"), set("d"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:372: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("d"), "dval")
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:373: DeprecationWarning: Please use assertEqual instead.
assert_equals(set(pool.keys()), set("abcdefgh"))
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:374: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.items()),
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:377: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.running(), 0)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:379: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting(), 0)
tests/dagpool_test.py::test_spawn_multiple
/build/source/tests/dagpool_test.py:380: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.waiting_for("h"), set())
tests/dagpool_test.py::test_spawn_many
/build/source/tests/dagpool_test.py:435: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("e"), "e")
tests/dagpool_test.py::test_spawn_many
/build/source/tests/dagpool_test.py:441: DeprecationWarning: Please use assertEqual instead.
assert_equals(sequence,
tests/dagpool_test.py::test_wait_each_all
tests/dagpool_test.py::test_wait_each_all
tests/dagpool_test.py::test_wait_each_all
tests/dagpool_test.py::test_wait_each_all
tests/dagpool_test.py::test_wait_each_all
/build/source/tests/dagpool_test.py:469: DeprecationWarning: Please use assertEqual instead.
assert_equals(k, keys[pos])
tests/dagpool_test.py::test_kill
/build/source/tests/dagpool_test.py:497: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("a"), None)
tests/dagpool_test.py::test_kill
/build/source/tests/dagpool_test.py:508: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("a"), 2)
tests/dagpool_test.py::test_post_collision_spawn
/build/source/tests/dagpool_test.py:536: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("a"), 3)
tests/dagpool_test.py::test_post_replace
/build/source/tests/dagpool_test.py:556: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.get("a"), 2)
tests/dagpool_test.py::test_post_replace
/build/source/tests/dagpool_test.py:557: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each("a")), dict(a=2))
tests/dagpool_test.py::test_post_replace
/build/source/tests/dagpool_test.py:558: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool.wait("a"), dict(a=2))
tests/dagpool_test.py::test_post_replace
/build/source/tests/dagpool_test.py:559: DeprecationWarning: Please use assertEqual instead.
assert_equals(pool["a"], 2)
tests/dagpool_test.py::test_waitall_exc
/build/source/tests/dagpool_test.py:601: DeprecationWarning: Please use assertEqual instead.
assert_equals(err.key, "a")
tests/dagpool_test.py::test_waitall_exc
/build/source/tests/dagpool_test.py:604: DeprecationWarning: Please use assertEqual instead.
assert_equals(str(err.exc), "bogus")
tests/dagpool_test.py::test_propagate_exc
/build/source/tests/dagpool_test.py:619: DeprecationWarning: Please use assertEqual instead.
assert_equals(errc.key, "c")
tests/dagpool_test.py::test_propagate_exc
/build/source/tests/dagpool_test.py:621: DeprecationWarning: Please use assertEqual instead.
assert_equals(errb.key, "b")
tests/dagpool_test.py::test_propagate_exc
/build/source/tests/dagpool_test.py:623: DeprecationWarning: Please use assertEqual instead.
assert_equals(erra.key, "a")
tests/dagpool_test.py::test_propagate_exc
/build/source/tests/dagpool_test.py:626: DeprecationWarning: Please use assertEqual instead.
assert_equals(str(erra.exc), "bogus")
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:684: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_success()), dict(a=bogua))
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:685: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_success("ab")), dict(a=bogua))
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:686: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_success("a")), dict(a=bogua))
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:687: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_success("b")), {})
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:690: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_exception()), dict(b=bogub))
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:691: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_exception("ab")), dict(b=bogub))
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:692: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_exception("a")), {})
tests/dagpool_test.py::test_post_get_exc
/build/source/tests/dagpool_test.py:693: DeprecationWarning: Please use assertEqual instead.
assert_equals(dict(pool.wait_each_exception("b")), dict(b=bogub))
tests/greendns_test.py::TinyDNSTests::test_noraise_dns_tcp
/build/source/tests/greendns_test.py:905: DeprecationWarning: please use dns.resolver.Resolver.resolve() instead
response = resolver.query('host.example.com', 'a', tcp=True)
tests/greendns_test.py::TinyDNSTests::test_raise_dns_tcp
/build/source/tests/greendns_test.py:896: DeprecationWarning: please use dns.resolver.Resolver.resolve() instead
resolver.query('host.example.com', 'a', tcp=True)
tests/openssl_test.py::test_import
/build/source/eventlet/green/OpenSSL/crypto.py:1: DeprecationWarning: PKCS#7 support in pyOpenSSL is deprecated. You should use the APIs in cryptography.
from OpenSSL.crypto import *
tests/openssl_test.py::test_import
/build/source/eventlet/green/OpenSSL/crypto.py:1: DeprecationWarning: PKCS#12 support in pyOpenSSL is deprecated. You should use the APIs in cryptography.
from OpenSSL.crypto import *
tests/tpool_test.py: 1000 warnings
/build/source/tests/tpool_test.py:322: DeprecationWarning: Please use assertTrue instead.
assert_(token is not None)
tests/wsgi_test.py::TestHttpd::test_disable_header_name_capitalization
/build/source/eventlet/greenthread.py:221: DeprecationWarning: capitalize_response_headers is disabled.
Please, make sure you know what you are doing.
HTTP headers names are case-insensitive per RFC standard.
Most likely, you need to fix HTTP parsing in your client software.
result = function(*args, **kwargs)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/patcher_test.py::test_fork_after_monkey_patch - AssertionError: ...
= 1 failed, 564 passed, 119 skipped, 16 deselected, 1079 warnings in 101.58s (0:01:41) =
Hello,
I think this bug is now fixed, please can you check with the latest eventlet versions and confirm if you still reproduce the issue. I do not observe similar issue on my side.
Thanks in advance.
I suspect this is some kind of race condition that might not be easy to trigger, especially on an otherwise idle machine.
It appears that eventlet 0.35.2 still has this issue because when the eventlet package was upgraded to 0.35.2 in nixpkgs, the author of the commit disabled this specific test (test_fork_after_monkey_patch) and added a comment containing one of the assertion errors that appear in this issue (AssertionError: Expected single line "pass" in stdout):
https://github.com/NixOS/nixpkgs/commit/6f5d20311c3b19990eae403c17b1c6baf5e4ca62#diff-0b26da1cc8615e457beb57a19949a500f7695bd9462ef723b4ce50defb4cf20eR63
However, I've re-enabled this test on my local machine, so if you want you can close this issue and I will reopen it if I run into this failure again...
Thanks for your feedback. Lets this GH issue opened.
I can now confirm that this issue still exists in eventlet 0.35.2.