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

No such file or directory: /tmp/mdkatex/adcebc8e8ae41063cc456af7bc8c63e5b2023b67b78beea322358d8b8b4409d5.tex #16

Open
dwLG00 opened this issue Jul 26, 2023 · 4 comments

Comments

@dwLG00
Copy link

dwLG00 commented Jul 26, 2023

Whenever I run md.convert(), I get hit with some variation of the error No such file or directory: /tmp/mdkatex/adcebc8e8ae41063cc456af7bc8c63e5b2023b67b78beea322358d8b8b4409d5.tex (line 234 in _write_tex2html of wrapper.py).
Looking in the code, it looks like the problem is caused by trying to delete a temporary tex file that was created but doesn't exist anymore for whatever reason. I'm confused because the file is explicitly created earlier on in _write_tex2html, and if there's any issues with the file creation it should just raise an error then.

The markdown-katex version:
markdown-katex version: v202112.1034 (using binary: /usr/bin/npx --no-install katex) 0.16.8

@mbarkhau
Copy link
Owner

Thanks for the report. I vaguely remember dealing with this as a Heisenbug. If you can further debug this, I'd greatly appreciate it.

@dwLG00
Copy link
Author

dwLG00 commented Aug 5, 2023

Update: You were right about it being a heisenbug, it completely disappeared and everything is working properly.
I think I'm going to leave the issue open just so people know it's a known issue

@tovrstra
Copy link
Contributor

I'm running into this issue and can occasionally reproduce it, but only when generating many documents in parallel. Could this be a concurrency issue?

@tovrstra
Copy link
Contributor

The following line is potentially causing this problem:

TMP_DIR = pl.Path(tempfile.gettempdir()) / "mdkatex"

When multiple processes are running this plugin, they operate in the same working directory, where one process is cleaning things up while another one is still using it. To avoid this, each wrapper instance can use mkdtemp instead.

I may give this a try to see if it helps.

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

3 participants