daisy / ace

Ace by DAISY, an Accessibility Checker for EPUB
MIT License
74 stars 22 forks source link

Error on multiple instances of ACE #384

Open thiagoeec opened 1 year ago

thiagoeec commented 1 year ago

Ever since I upgraded from 1.2.7 to 1.3.1, I'm having trouble on launching multiple instances of ACE simultaneously. It never happened before, but now I'm getting this type of errors on stdout:

did-fail-load: -3 - - acehttps://0.0.0.0//OEBPS/Text/book-2.html?AXE_RUNNER=2 - true - 6 - 1 did-fail-load: -3 - - acehttps://0.0.0.0//OEBPS/Text/cover.html?AXE_RUNNER=0 - true - 4 - 1 did-fail-load: -3 - - acehttps://0.0.0.0//OEBPS/Text/book-1.html?AXE_RUNNER=1 - true - 5 - 1

When this happens, I get a return code of 1, and no report is generated. Only some books of the batch are affected.

Background: 1) I'm running ACE as part of a calibre plugin (Check Books). 2) It is written in python and uses subprocess.Popen() to run ACE. 3) stdout and stderr are directed to subprocess.PIPE 4) Since PIPE has a limited size, I'm running ACE in silent mode: args = 'ace -s -f -o check_books_path -l user_lang book_path' 5) The multiple instances of ACE are being launched using multi-threading: threading.Thread()

Workaround:

Temporarily, I've modified the code to rerun ACE on books that get this type of error. Running a second time usually solves the problem. Also, when running a single instance, the error does not happen.

My system:

danielweck commented 1 year ago

Very interesting, thank you. Could you please try invoking the ace-puppeteer executable instead of ace (which is now a synonym for ace-electron).

thiagoeec commented 1 year ago

I just tried using ace-puppeteer, and it worked perfectly. All books were processed. The problem seems to be related to ace-electron.

P.S.: I did notice a speed diference, though. Using ace-electron seems to be a lot faster, even if it had to rerun the check on the failing books.

danielweck commented 1 year ago

This is valuable feedback, thank you.

I suspected that the Electron option (now default) would be a net improvement in terms of performance and consistency (same engine in Ace command line and Ace App / GUI), so hopefully we will soon figure out how to fix the "multiple processes" bug.

The Puppeteer version currently integrated in Ace is slightly old (compared with Electron which ships a recent NodeJS and Chromium runtime) due to technical limitations / incompatible software dependencies. However I dont anticipate Puppeteer to have become much faster, even with their switch from Chromium to Google Chrome.

As you witnessed yourself, in some/many cases we are looking at Ace's Electron integration being twice as fast as with Puppeteer.