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

Esbonio crashes when Sphinx Immaterial Theme is used #451

Closed
twodrops opened this issue Sep 22, 2022 · 2 comments
Closed

Esbonio crashes when Sphinx Immaterial Theme is used #451

twodrops opened this issue Sep 22, 2022 · 2 comments
Labels
bug Something isn't working lsp Issues that relate to the language server

Comments

@twodrops
Copy link

Immaterial theme looks like a good replacement for the not so good maintained RTD Theme.

Esbonio however has a problem with it.

On first startup the theme downloads and caches Google fonts.
https://github.com/jbms/sphinx-immaterial/blob/8c94664fd56baa87abf023a7b3aa7748c3c15828/sphinx_immaterial/external_resource_cache.py#L129

It works fine with a local sphinx-build.
Esbonio does not seem to like this async download step during its build and just hangs.

/usr/local/lib/python3.10/site-packages/esbonio/lsp/sphinx/init.py:164: RuntimeWarning: coroutine 'add_google_fonts..do_fetch' was never awaited

I have raised an issue at Immaterial theme as well
jbms/sphinx-immaterial#163

@alcarney alcarney added bug Something isn't working lsp Issues that relate to the language server labels Sep 22, 2022
@jbms
Copy link

jbms commented Sep 22, 2022

I suspect the issue has to do with nesting of asyncio stuff.

In principle the code in sphinx-immaterial for downloading resources could be changed to not use asyncio. But it would be better if that were not necessary.

I wonder if using nest-asyncio would fix the issue:
https://pypi.org/project/nest-asyncio/

Still it is odd that it would hang rather than raise an exception.

Perhaps you can do some additional debugging and try to figure out the cause a bit more?

@alcarney alcarney added this to Esbonio Jan 14, 2023
@github-project-automation github-project-automation bot moved this to Todo in Esbonio Jan 14, 2023
tim-nordell-nimbelink added a commit to tim-nordell-nimbelink/sphinx-immaterial that referenced this issue May 5, 2023
The Esbonio language server runs its own asyncio loop context when it
invokes the Sphinx code.  This causes the asyncio.run() call to complain
since it's already being run in the same thread.

Since we're already running a set of threads here using PoolExecutor, we can
run one more thread which runs the asyncio.run() context in a separate
thread.  This mitigates the interoperability issue with the Esbonio
language server at the cost of an additional thread, and at the cost of
blocking the coroutine loop within the Esbonio language server for the
closing of the download set.

(See also swyddfa/esbonio#451)
jbms pushed a commit to jbms/sphinx-immaterial that referenced this issue May 5, 2023
The Esbonio language server runs its own asyncio loop context when it
invokes the Sphinx code.  This causes the asyncio.run() call to complain
since it's already being run in the same thread.

Since we're already running a set of threads here using PoolExecutor, we can
run one more thread which runs the asyncio.run() context in a separate
thread.  This mitigates the interoperability issue with the Esbonio
language server at the cost of an additional thread, and at the cost of
blocking the coroutine loop within the Esbonio language server for the
closing of the download set.

(See also swyddfa/esbonio#451)
@twodrops
Copy link
Author

twodrops commented May 9, 2023

This issue has been fixed now by immaterial theme and can therefore be closed.
jbms/sphinx-immaterial#163

@twodrops twodrops closed this as completed May 9, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Esbonio May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp Issues that relate to the language server
Projects
Status: Done
Development

No branches or pull requests

3 participants