puppeteer-with-fingerprints: Cannot run puppeteer with fingerprint using node thread worker
try to run 2 thread worker using same puppeteer script but one of browser show output error :
- “Error: Lock is not acquired/owned by you”
- “Unable to start engine process (code: 3221225477)”
bellow is example code to produce this error. example.js :
import { plugin } from 'puppeteer-with-fingerprints'
;(async () => {
// Launch the browser instance:
const browser = await plugin.launch({ headless: false })
// The rest of the code is the same as for a standard `puppeteer` library:
const page = await browser.newPage()
await page.goto('https://example.com')
// Print the browser viewport size:
console.log(
'Viewport:',
await page.evaluate(() => ({
deviceScaleFactor: window.devicePixelRatio,
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight,
}))
)
await browser.close()
})()
code to run new thread worker: thread.js:
import { Worker, isMainThread } from 'worker_threads'
// Instantiate a Mocha instance.
var scriptpath = './src/scripts/example.js'
if (isMainThread) {
for (let i = 0; i < 2; i++) {
// workerPath not scriptpath
let worker = new Worker(scriptpath)
worker.on('message', msg => {
console.log('worker response: ' + msg);
})
worker.on('exit', (code) => {
console.log(`Script run stopped with exit code ${code}`)
})
}
}
Error log produce: After first thread run. i believe this error code for 2 thread worker
Viewport: { deviceScaleFactor: 1, width: 929, height: 879 } >>>> log for first thread
node:internal/event_target:1010
process.nextTick(() => { throw err; });
^
Error: Unable to start engine process (code: 3221225477)
This could be due to the fact that the engine was not downloaded or unpacked correctly.
Try completely deleting the engine folder and restarting the code until it completes.
If this does not help, open an issue with a detailed description of the problem.
at C:\Users\OneDrive\Desktop\xxxxr\node_modules\bas-remote-node\src\services\engine.js:104:17
at ChildProcess.exithandler (node:child_process:427:5)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe.<anonymous> (node:net:320:12)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
sometime this error occur:
node:internal/event_target:1010
process.nextTick(() => { throw err; });
^
Error: Lock is not acquired/owned by you
at C:\Users\OneDrive\Desktop\xxxx\node_modules\proper-lockfile\lib\lockfile.js:285:43
at LOOP (node:fs:2673:14)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28) {
code: 'ENOTACQUIRED'
}
already try to delete and install new bas engine data. but error still occur for second thread. the first thread success without error
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18 (3 by maintainers)
@CheshireCaat Thank you for you reply regarding this multithread issue. I really appreciate what you and you team doing here. It took a lot of afford to create this plugin that able to mask fingerprint. Not many company/developer create this framework for free. By providing detail documentation really help us a lot, but I do understand you guys need more time to improve BAS. Hope in future a lot improvement can be done. Thank you again!