-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
AsyncMongoClient causes "RuntimeError: set changed size during iteration" at shutdown:
[2024/09/06 10:42:09.673] ______________ ERROR at teardown of TestWriteConcern.test_invalid ______________ [2024/09/06 10:42:09.673] cls = <class '_pytest.runner.CallInfo'> [2024/09/06 10:42:09.673] func = <function call_and_report.<locals>.<lambda> at 0x00007f546526d7e0> [2024/09/06 10:42:09.673] when = 'teardown' [2024/09/06 10:42:09.673] reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>) [2024/09/06 10:42:09.673] @classmethod [2024/09/06 10:42:09.673] def from_call( [2024/09/06 10:42:09.673] cls, [2024/09/06 10:42:09.673] func: Callable[[], TResult], [2024/09/06 10:42:09.673] when: Literal["collect", "setup", "call", "teardown"], [2024/09/06 10:42:09.673] reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None, [2024/09/06 10:42:09.673] ) -> CallInfo[TResult]: [2024/09/06 10:42:09.673] """Call func, wrapping the result in a CallInfo. [2024/09/06 10:42:09.673] :param func: [2024/09/06 10:42:09.673] The function to call. Called without arguments. [2024/09/06 10:42:09.673] :type func: Callable[[], _pytest.runner.TResult] [2024/09/06 10:42:09.673] :param when: [2024/09/06 10:42:09.673] The phase in which the function is called. [2024/09/06 10:42:09.673] :param reraise: [2024/09/06 10:42:09.673] Exception or exceptions that shall propagate if raised by the [2024/09/06 10:42:09.673] function, instead of being wrapped in the CallInfo. [2024/09/06 10:42:09.673] """ [2024/09/06 10:42:09.673] excinfo = None [2024/09/06 10:42:09.673] start = timing.time() [2024/09/06 10:42:09.673] precise_start = timing.perf_counter() [2024/09/06 10:42:09.673] try: [2024/09/06 10:42:09.673] > result: TResult | None = func() [2024/09/06 10:42:09.673] /home/ec2-user/.local/share/hatch/env/virtual/pymongo/4AmjUQL8/test/lib/pypy3.10/site-packages/_pytest/runner.py:341: [2024/09/06 10:42:09.673] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2024/09/06 10:42:09.673] /home/ec2-user/.local/share/hatch/env/virtual/pymongo/4AmjUQL8/test/lib/pypy3.10/site-packages/_pytest/runner.py:242: in <lambda> [2024/09/06 10:42:09.673] lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise [2024/09/06 10:42:09.673] /home/ec2-user/.local/share/hatch/env/virtual/pymongo/4AmjUQL8/test/lib/pypy3.10/site-packages/pluggy/_hooks.py:513: in __call__ [2024/09/06 10:42:09.673] return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) [2024/09/06 10:42:09.673] /home/ec2-user/.local/share/hatch/env/virtual/pymongo/4AmjUQL8/test/lib/pypy3.10/site-packages/pluggy/_manager.py:120: in _hookexec [2024/09/06 10:42:09.673] return self._inner_hookexec(hook_name, methods, kwargs, firstresult) [2024/09/06 10:42:09.673] /home/ec2-user/.local/share/hatch/env/virtual/pymongo/4AmjUQL8/test/lib/pypy3.10/site-packages/_pytest/threadexception.py:97: in pytest_runtest_teardown [2024/09/06 10:42:09.673] yield from thread_exception_runtest_hook() [2024/09/06 10:42:09.673] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2024/09/06 10:42:09.673] def thread_exception_runtest_hook() -> Generator[None, None, None]: [2024/09/06 10:42:09.673] with catch_threading_exception() as cm: [2024/09/06 10:42:09.673] try: [2024/09/06 10:42:09.673] yield [2024/09/06 10:42:09.673] finally: [2024/09/06 10:42:09.673] if cm.args: [2024/09/06 10:42:09.673] thread_name = ( [2024/09/06 10:42:09.673] "<unknown>" if cm.args.thread is None else cm.args.thread.name [2024/09/06 10:42:09.673] ) [2024/09/06 10:42:09.673] msg = f"Exception in thread {thread_name}\n\n" [2024/09/06 10:42:09.673] msg += "".join( [2024/09/06 10:42:09.673] traceback.format_exception( [2024/09/06 10:42:09.673] cm.args.exc_type, [2024/09/06 10:42:09.673] cm.args.exc_value, [2024/09/06 10:42:09.673] cm.args.exc_traceback, [2024/09/06 10:42:09.673] ) [2024/09/06 10:42:09.673] ) [2024/09/06 10:42:09.673] > warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg)) [2024/09/06 10:42:09.673] E pytest.PytestUnhandledThreadExceptionWarning: Exception in thread pymongo_server_monitor_thread [2024/09/06 10:42:09.673] E [2024/09/06 10:42:09.673] E Traceback (most recent call last): [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/threading.py", line 1016, in _bootstrap_inner [2024/09/06 10:42:09.673] E self.run() [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/threading.py", line 953, in run [2024/09/06 10:42:09.673] E self._target(*self._args, **self._kwargs) [2024/09/06 10:42:09.673] E File "/data/mci/5facc217925f243cd6822dbb3ca61cd8/src/pymongo/asynchronous/periodic_executor.py", line 78, in _run_async [2024/09/06 10:42:09.673] E asyncio.run(self._run()) # type: ignore[func-returns-value] [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/asyncio/runners.py", line 48, in run [2024/09/06 10:42:09.673] E loop.run_until_complete(loop.shutdown_asyncgens()) [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/asyncio/base_events.py", line 649, in run_until_complete [2024/09/06 10:42:09.673] E return future.result() [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/asyncio/futures.py", line 201, in result [2024/09/06 10:42:09.673] E raise self._exception.with_traceback(self._exception_tb) [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/asyncio/tasks.py", line 232, in __step [2024/09/06 10:42:09.673] E result = coro.send(None) [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/asyncio/base_events.py", line 544, in shutdown_asyncgens [2024/09/06 10:42:09.673] E closing_agens = list(self._asyncgens) [2024/09/06 10:42:09.673] E File "/opt/python/pypy3.10/lib/pypy3.10/_weakrefset.py", line 78, in __len__ [2024/09/06 10:42:09.673] E for wr in self.data: [2024/09/06 10:42:09.673] E RuntimeError: set changed size during iteration [2024/09/06 10:42:09.673] /home/ec2-user/.local/share/hatch/env/virtual/pymongo/4AmjUQL8/test/lib/pypy3.10/site-packages/_pytest/threadexception.py:82: PytestUnhandledThreadExceptionWarning
- related to
-
PYTHON-4725 Async client should use tasks for SDAM instead of threads
- Closed