Skip to content
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

asyncio lock Future attached to a different loop #49

Open
nbanyan opened this issue Nov 13, 2024 · 0 comments
Open

asyncio lock Future attached to a different loop #49

nbanyan opened this issue Nov 13, 2024 · 0 comments

Comments

@nbanyan
Copy link

nbanyan commented Nov 13, 2024

When I have formats.pdf.concurrency set higher than 2 and the site includes more than a few pages I get the following error:

Traceback (most recent call last):
  File "/Users/training4/venv3.9/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs/__main__.py", line 268, in serve_command
    serve.serve(**kwargs)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 85, in serve
    builder(config)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 67, in builder
    build(config, serve_url=None if is_clean else serve_url, dirty=is_dirty)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs/commands/build.py", line 347, in build
    config.plugins.on_post_build(config=config)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs/plugins.py", line 602, in on_post_build
    return self.run_event('post_build', config=config)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs/plugins.py", line 568, in run_event
    result = method(**kwargs)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs_exporter/formats/pdf/plugin.py", line 154, in _on_post_build_1
    self.loop.run_until_complete(asyncio.gather(*concurrently(self.tasks, max(1, self.config.concurrency or 1))))
  File "/usr/local/Cellar/[email protected]/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs_exporter/helpers.py", line 29, in limit
    return await asyncio.create_task(coroutine)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs_exporter/formats/pdf/plugin.py", line 135, in render
    pdf, pages = await self.renderer.render(html)
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs_exporter/formats/pdf/renderer.py", line 87, in render
    await self.browser.launch()
  File "/Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs_exporter/formats/pdf/browser.py", line 57, in launch
    async with self.lock:
  File "/usr/local/Cellar/[email protected]/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/locks.py", line 14, in __aenter__
    await self.acquire()
  File "/usr/local/Cellar/[email protected]/3.9.20/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/locks.py", line 120, in acquire
    await fut
RuntimeError: Task <Task pending name='Task-5' coro=<Plugin.on_post_page.<locals>.render() running at /Users/training4/venv3.9/lib/python3.9/site-packages/mkdocs_exporter/formats/pdf/plugin.py:135> cb=[<TaskWakeupMethWrapper object at 0x10efeae20>()]> got Future <Future pending> attached to a different loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant