Skip to content

Thread unsafety with 3.13t: "ValueError: tool 1 is not in use" #1970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nedbat opened this issue May 20, 2025 · 2 comments
Closed

Thread unsafety with 3.13t: "ValueError: tool 1 is not in use" #1970

nedbat opened this issue May 20, 2025 · 2 comments
Labels
bug Something isn't working fixed

Comments

@nedbat
Copy link
Owner

nedbat commented May 20, 2025

This happens occasionally when running the full test suite on my Mac:

tests/test_concurrency.py::test_thread_safe_save_data
  /Users/ned/coverage/trunk/.tox/py313t/lib/python3.13t/site-packages/_pytest/threadexception.py:82: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-10 (random_load)

  Traceback (most recent call last):
    File "/usr/local/pyenv/pyenv/versions/3.13.3t/lib/python3.13t/threading.py", line 1041, in _bootstrap_inner
      self.run()
      ~~~~~~~~^^
    File "/usr/local/pyenv/pyenv/versions/3.13.3t/lib/python3.13t/threading.py", line 992, in run
      self._target(*self._args, **self._kwargs)
      ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/ned/coverage/trunk/tests/test_concurrency.py", line 673, in random_load
      mod = import_local_file(module_name)
    File "/Users/ned/coverage/trunk/coverage/misc.py", line 300, in import_local_file
      spec.loader.exec_module(mod)
      ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
    File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
    File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
    File "/private/var/folders/6j/khn0mcrj35d1k3yylpl8zl080000gn/T/pytest-of-ned/pytest-14/popen-gw1/test_thread_safe_save_data0/test_modules/m192.py", line 0, in <module>


      def f(): pass

    File "/Users/ned/coverage/trunk/coverage/sysmon.py", line 369, in sysmon_py_start
      sys_monitoring.set_local_events(self.myid, code, local_events)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ValueError: tool 1 is not in use

    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
@nedbat nedbat added the bug Something isn't working label May 20, 2025
@nedbat
Copy link
Owner Author

nedbat commented May 21, 2025

Fixed in commit 8b9cecc.

@nedbat nedbat closed this as completed May 21, 2025
@nedbat
Copy link
Owner Author

nedbat commented May 21, 2025

This is now released as part of coverage 7.8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

1 participant