Skip to content

RuntimeError: set_wakeup_fd only works in main thread of the main interpreter #645

@freyes

Description

@freyes

The PR #608 is introducing support for Juju 3.x, during the testing it was found that zaza is incompatible with python-libjuju>=3.2, which prevents using juju 3.2 and 3.3.

The stacktrace of the error is:

Using /home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages
  Finished processing dependencies for zaza==0.0.2.dev1
  func-target: commands[1]> functest-run-suite --keep-model --bundle first
  2024-01-17 15:45:23 [INFO] Could not determine correct model aliasfrom tests.yaml, using default
  Traceback (most recent call last):
    File "/usr/lib/python3.10/asyncio/unix_events.py", line 105, in add_signal_handler
      signal.set_wakeup_fd(self._csock.fileno())
  ValueError: set_wakeup_fd only works in main thread of the main interpreter
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/home/runner/work/zaza/zaza/.tox/func-target/bin/functest-run-suite", line 33, in <module>
      sys.exit(load_entry_point('zaza==0.0.2.dev1', 'console_scripts', 'functest-run-suite')())
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/charm_lifecycle/func_test_runner.py", line 405, in main
      func_test_runner(
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/charm_lifecycle/func_test_runner.py", line 313, in func_test_runner
      run_env_deployment(env_deployment, keep_model=preserve_model,
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/charm_lifecycle/func_test_runner.py", line 125, in run_env_deployment
      prepare.prepare(
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/utilities/run_report.py", line 144, in wrapper
      result = f(*args, **kwds)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/charm_lifecycle/prepare.py", line 44, in prepare
      zaza.controller.add_model(
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/__init__.py", line 224, in _wrapper
      return future.result(timeout)
    File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
      return self.__get_result()
    File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
      raise self._exception
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/__init__.py", line 209, in _runner
      return await f(*args, **kwargs)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/zaza/controller.py", line 40, in async_add_model
      await controller.connect()
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/controller.py", line 108, in connect
      await self._connector.connect_controller(controller_name, **kwargs)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connector.py", line 127, in connect_controller
      await self.connect(
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connector.py", line 86, in connect
      self._connection = await Connection.connect(**kwargs)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connection.py", line 356, in connect
      await self._connect_with_redirect([_ep])
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connection.py", line 908, in _connect_with_redirect
      login_result = await self._connect_with_login(endpoints)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connection.py", line 875, in _connect_with_login
      await self._connect(endpoints)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connection.py", line 824, in _connect
      result = await task
    File "/usr/lib/python3.10/asyncio/tasks.py", line 571, in _wait_for_one
      return f.result()  # May raise f.exception().
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connection.py", line 813, in _try_endpoint
      return await self._open(endpoint, cacert)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connection.py", line 430, in _open
      loop.add_signal_handler(sig, _exit_tasks)
    File "/usr/lib/python3.10/asyncio/unix_events.py", line 107, in add_signal_handler
      raise RuntimeError(str(exc))
  RuntimeError: set_wakeup_fd only works in main thread of the main interpreter
  func-target: exit 1 (0.70 seconds) /home/runner/work/zaza/zaza> functest-run-suite --keep-model --bundle first pid=11317
.pkg: _exit> python /home/runner/.local/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  func-target: FAIL code 1 (26.05=setup[24.57]+cmd[0.78,0.70] seconds)
  evaluation failed :( (26.13 seconds)
Error: Process completed with exit code 1.

It seems this regression was introduced by juju/python-libjuju@62a988f part of python-libjuju>=3.2.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions