Skip to content

KeyError in parallel build with Sphinx 4.0.1 #9210

@pllim

Description

@pllim

Describe the bug

Sphinx build fails for astropy when we use Sphinx 4.0.1.

To Reproduce

See log in https://readthedocs.org/projects/astropy/builds/ , for example: https://readthedocs.org/projects/astropy/builds/13727660/

Expected behavior

Build is successful.

Your project

https://github.com/astropy/astropy/

Screenshots

N/A

Environment info

  • OS: Linux
  • Python version: 3.8
  • Sphinx version: 4.0.1
  • Sphinx extensions: astropy-sphinx-theme-1.1 numpydoc-1.1.0 sphinx-astropy-1.3 sphinx-automodapi-0.13 sphinx-changelog-1.0.0 sphinx-gallery-0.9.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-1.0.3 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 (full list in the RTD log above)
  • Extra tools: We have parallel build enabled in RTD

Additional context

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/events.py", line 101, in emit
    results.append(listener.handler(self.app, *args))
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/ext/viewcode.py", line 153, in env_merge_info
    used = env._viewcode_modules[modname][2]  # type: ignore
TypeError: 'bool' object is not subscriptable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/util/parallel.py", line 108, in join
    self._join_one()
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/util/parallel.py", line 130, in _join_one
    self._result_funcs.pop(tid)(self._args.pop(tid), result)
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 451, in merge
    self.env.merge_info_from(docs, env, self.app)
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/environment/__init__.py", line 310, in merge_info_from
    self.events.emit('env-merge-info', self, docnames, other)
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/events.py", line 109, in emit
    raise ExtensionError(__("Handler %r for event %r threw an exception") %
sphinx.errors.ExtensionError: Handler <function env_merge_info at 0x7f5f85293160> for event 'env-merge-info' threw an exception (exception: 'bool' object is not subscriptable)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/cmd/build.py", line 280, in build_main
    app.build(args.force_all, filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/application.py", line 350, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 292, in build_update
    self.build(to_build,
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 306, in build
    updated_docnames = set(self.read())
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 411, in read
    self._read_parallel(docnames, nproc=self.app.parallel)
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 462, in _read_parallel
    tasks.join()
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/util/parallel.py", line 111, in join
    self.terminate()
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/util/parallel.py", line 117, in terminate
    self._result_funcs.pop(tid)
KeyError: 12

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/envs/latest/lib/python3.8/site-packages/sphinx/util/parallel.py", line 117, in terminate
    self._result_funcs.pop(tid)
KeyError: 12
The full traceback has been saved in /tmp/sphinx-err-sfhj_9yk.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions