sphinx-contrib / plantuml

BSD 2-Clause "Simplified" License
115 stars 42 forks source link

Race condition multiprocessing #84

Closed ubmarco closed 11 months ago

ubmarco commented 11 months ago

When running the Sphinx write phase in parallel on Linux, I'm gettig this

sphinx.errors.SphinxParallelError:
  FileNotFoundError: 
    [Errno 2] No such file or directory:
      '/tmp/tmppcibdr7c/doc_needflow/_build/html/_plantuml/0d/0db02546484441d6314299f668aecf48fff9d4ca.png.new' -> '/tmp/tmppcibdr7c/doc_needflow/_build/html/_plantuml/0d/0db02546484441d6314299f668aecf48fff9d4ca.png'

After some investigation I found the source problem:

I see 2 solutions:

yuja commented 11 months ago

Good catch. I think the .new file should be created with a random name (by using mkstemp(prefix=outfname, dir=..) for example.) Since the output content is identical, we won't need locking nor randomness in the final output.

ubmarco commented 11 months ago

Awesome. Thanks for the quick fix, it works!