dabeaz / curio

Good Curio!
Other
4.04k stars 244 forks source link

Tests broken. #313

Closed mimi1vx closed 4 years ago

mimi1vx commented 4 years ago

Hello,

with python3.7 and pytest 4.6+ test suite run with python3 -m pytest ends with:

==== 90 failed, 164 passed, 2 skipped, 5 warnings, 1 error in 48.87 seconds ====

and stuck forever in the end

dabeaz commented 4 years ago

What platform? What tests? What errors are generated?

Note: A number of tests involve socket connections and will fail if run on a system where certain socket addresses are already in use.

mimi1vx commented 4 years ago

Linux kernel 5.5.4,

traceback of firs error:

tests/test_socket.py::test_create_connection FAILED                                                             [ 62%]Traceback (most recent call last):
  File "/home/mimi/git.public/curio/curio/kernel.py", line 721, in kernel_run
    trap = current.send(current._trap_result)
  File "/home/mimi/git.public/curio/curio/task.py", line 170, in send
    return self._send(value)
RuntimeError: cannot reuse already awaited coroutine

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.7/site-packages/pytest/__main__.py", line 7, in <module>
    raise SystemExit(pytest.main())
  File "/usr/lib/python3.7/site-packages/_pytest/config/__init__.py", line 92, in main
    config=config
  File "/usr/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3.7/site-packages/_pytest/main.py", line 239, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/usr/lib/python3.7/site-packages/_pytest/main.py", line 232, in wrap_session
    session=session, exitstatus=session.exitstatus
  File "/usr/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/lib/python3.7/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/usr/lib/python3.7/site-packages/_pytest/terminal.py", line 681, in pytest_sessionfinish
    outcome.get_result()
  File "/usr/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/lib/python3.7/site-packages/_pytest/runner.py", line 76, in pytest_sessionfinish
    session._setupstate.teardown_all()
  File "/usr/lib/python3.7/site-packages/_pytest/runner.py", line 324, in teardown_all
    self._pop_and_teardown()
  File "/usr/lib/python3.7/site-packages/_pytest/runner.py", line 297, in _pop_and_teardown
    self._teardown_with_finalization(colitem)
  File "/usr/lib/python3.7/site-packages/_pytest/runner.py", line 317, in _teardown_with_finalization
    self._callfinalizers(colitem)
  File "/usr/lib/python3.7/site-packages/_pytest/runner.py", line 314, in _callfinalizers
    raise val.with_traceback(tb)
  File "/usr/lib/python3.7/site-packages/_pytest/runner.py", line 305, in _callfinalizers
    fin()
  File "/usr/lib/python3.7/site-packages/_pytest/fixtures.py", line 872, in finish
    raise val.with_traceback(tb)
  File "/usr/lib/python3.7/site-packages/_pytest/fixtures.py", line 865, in finish
    func()
  File "/home/mimi/git.public/curio/tests/conftest.py", line 12, in <lambda>
    request.addfinalizer(lambda: k.run(shutdown=True))
  File "/home/mimi/git.public/curio/curio/kernel.py", line 160, in run
    self._runner(_shutdown_tasks(tocancel))
  File "/home/mimi/git.public/curio/curio/kernel.py", line 731, in kernel_run
    del tasks[active.id]
KeyError: 413
Exception ignored in: <function Task.__del__ at 0x7f51204a8840>
Traceback (most recent call last):
  File "/home/mimi/git.public/curio/curio/task.py", line 161, in __del__
  File "/home/mimi/git.public/curio/curio/task.py", line 225, in exception
RuntimeError: Task not terminated
Exception ignored in: <function Kernel.__del__ at 0x7f512044b840>
Traceback (most recent call last):
  File "/home/mimi/git.public/curio/curio/kernel.py", line 114, in __del__
RuntimeError: Curio kernel not properly terminated.  Please use Kernel.run(shutdown=True)
mimi1vx commented 4 years ago

whole log https://build.opensuse.org/build/home:mimi_vx:branches:devel:languages:python/openSUSE_Tumbleweed/i586/python-curio/_log

same results on x86_64

dabeaz commented 4 years ago

Will look into it. Thanks.

dabeaz commented 4 years ago

Reproducible on Ubuntu. It appears as if something is causing the remainder of the entire test suite to fail. May be a problem with the tests themselves as opposed to intrinsic problem with Curio. Looking into it.

dabeaz commented 4 years ago

There is some kind of very strange side-effect of a test involving socket.fromfd(). I've disabled it and the entire test-suite now passes. Will need to investigate further as I have no idea why it's actually breaking the test suite. You'll need to pull from Github to verify behavior on your system.

mimi1vx commented 4 years ago

works like charm on openSUSE :D