question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed tests in `tests/test_pr_curve.py`: cannot schedule new futures after interpreter shutdown

See original GitHub issue

Describe the bug

Running pytest on both the latest tagged version (2.4) and master results in failed tests in tests/test_pr_curve.py, specifically test_pr_purve and test_pr_purve_raw (test_smoke runs fine). The error message is RuntimeError: cannot schedule new futures after interpreter shutdown.

Minimal runnable code to reproduce the behavior

pytest . in master tensorboardX checkout.

Expected behavior

All enabled tests succeeding.

There are other tests failing apart of tests/test_pr_curve.py, BTW (tests/test_lint.py, tests/test_summary.py, tests/test_visdom.py and tests/test_writer.py) but each failure seems to be a separate issue.

Environment

Reproduced both in docker image for Ubuntu 22.04 and in FHSUserEnv environment on NixOS 21.11 + master nixpkgs.

pip list|grep -E "torch|proto|tensor"
protobuf                3.15.0
tensorboard             2.7.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.0
torch                   1.10.1
torchfile               0.1.0

Python environment

virtualenv 20.10.0 and Python 3.9.9 both on Ubuntu 22.04 and NixOS.

Additional context

The stack trace:

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/var/tmp/tensorboardX/tensorboardX/event_file_writer.py", line 69, in flush
    self._py_recordio_writer.flush()
  File "/var/tmp/tensorboardX/tensorboardX/record_writer.py", line 187, in flush
    self._writer.flush()
  File "/var/tmp/tensorboardX/tensorboardX/record_writer.py", line 93, in flush
    s3.upload_fileobj(upload_buffer, bucket, path)
  File "/var/tmp/tensorboardx-env/lib/python3.9/site-packages/boto3/s3/inject.py", line 537, in upload_fileobj
    future = manager.upload(
  File "/var/tmp/tensorboardx-env/lib/python3.9/site-packages/s3transfer/manager.py", line 326, in upload
    return self._submit_transfer(
  File "/var/tmp/tensorboardx-env/lib/python3.9/site-packages/s3transfer/manager.py", line 500, in _submit_transfer
    self._submission_executor.submit(
  File "/var/tmp/tensorboardx-env/lib/python3.9/site-packages/s3transfer/futures.py", line 467, in submit
    future = ExecutorFuture(self._executor.submit(task))
  File "/nix/store/rppr9s436950i1dlzknbmz40m2xqqnxc-python3-3.9.9/lib/python3.9/concurrent/futures/thread.py", line 169, in submit
    raise RuntimeError('cannot schedule new futures after '
RuntimeError: cannot schedule new futures after interpreter shutdown

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ndlcommented, Feb 5, 2022

At current nixpkgs master branch I cannot reproduce test_pr_curve.py test failure either, but I do get the same error stack trace after tests finish (not attributed to any test in particular?)

After https://github.com/lanpa/tensorboardX/pull/657 is applied, as far as I can see there are no failures anymore - so I think this pull request fixes the issue indeed!

1reaction
Mic92commented, Jan 9, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: cannot schedule new futures after interpreter ...
In case you are using python-telegram-bot, you might be missing an updater.idle() call after updater.start_polling(). I reported a bug here, ...
Read more >
RuntimeError: cannot schedule new futures after interpreter ...
What happened: I get the following exception when trying to run a simple example: Error in atexit._run_exitfuncs: Traceback (most recent ...
Read more >
ThreadPoolExecutor with wait=True shuts down too early
shutdown(wait=True) ``` When debugging, it shows "cannot schedule new futures after shutdown": Exception has occurred: RuntimeError cannot ...
Read more >
RuntimeError: Cannot schedule new tasks after shutdown
The point of the test is to make sure that if the scheduler has to be shut down, it can recover: When it...
Read more >
Source code for concurrent.futures.thread
This is done to allow the interpreter # to exit when there are still idle ... raise RuntimeError('cannot schedule new futures after shutdown')...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found