You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems when querying tesseract.js from multiple threads, the eng.traineddata is locked and throws errors like
Error opening data file ./eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Error opening data file ./eng.traineddata Tesseract couldn't load any languages!
To reproduce this:
const { Worker } = require('worker_threads')
function runService(workerData) {
return new Promise((resolve, reject) => {
const worker = new Worker('./databaseTests.js', { workerData });
worker.on('message', resolve);
worker.on('error', reject);
worker.on('exit', (code) => {
if (code !== 0)
reject(new Error(`Worker stopped with exit code ${code}`));
})
})
}
async function run() {
const result = await runService('world')
console.log(result);
}
(async () => {
while(true){
run().catch(err => console.error(err))
await new Promise(resolve => setTimeout(resolve, 5));
}
})();
In databaseTests I am simply creating a new worker:
@herecy I was able to reproduce this bug in version 2, but not the current version (v3). If this issue is still active, please confirm you still encounter this bug in the latest version and provide a reproducible example.
Closing this issue as we implemented multiple changes that should greatly reduce or eliminate errors with cached .traineddata files in v3 and v4. If you experience this type of error using v4, please open a new issue.
It seems when querying tesseract.js from multiple threads, the eng.traineddata is locked and throws errors like
Error opening data file ./eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Error opening data file ./eng.traineddata Tesseract couldn't load any languages!
To reproduce this:
In databaseTests I am simply creating a new worker:
Is there any way to reuse the worker or to skip checking the trained data file?
The text was updated successfully, but these errors were encountered: