-
Notifications
You must be signed in to change notification settings - Fork 24
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
Issues running multiple instances #7
Comments
Having this error quite a bit myself. Any help would be appreciated. I run 10 apps at the same time and use pm2 and I get this often enough.
|
same problem |
There is a simple work around - stop using async. When using async the main thread switches between different running instances and if those both share the same data folder then you will receive this error. You can either run sequentially (await each browser before starting the next) Use threads and note you should specify a separate |
It happens if more than one process run with same engine folder. Seems the root of problem is suppressed exceptions in bas-remote-engine engine._lock().
It suppresses any errors raised by locker, eg. error "Lock file is already being held" if multiple processes are running. It means client.engine.lock() were not able to get lock but continues and defines client.close() on timeout that calls engine.locker.unlock() inside. in case of 2+ processes only one has lock and if any other process does not call engine for longer then close() timeout (300_000) then client.close() is really called:
In this case engine.close() fails and left system with isStarted is true but socket has already closed. if scripts continue it fails with "Can't send data because WebSocket is not opened." error: CheshireCaat/bas-remote-node#19 2 additional moments:
related to #CheshireCaat/bas-remote-node#19 |
@dmitryp-rebel you should strictly not use one folder when working with multiple clients in any form - this has already been discussed in closed tickets, an API has also been added for configuring the working folder - you can also use environment variables: // For the first process:
plugin.setWorkingFolder('./fd1');
// For the second process:
plugin.setWorkingFolder('./fd2'); I agree that the The logic of the lock file is necessary for the correct and safe operation of the engine; its presence guarantees the functionality of the engine version management, as well as the safety of the necessary files. If for some reason you are not satisfied with this, I will be glad to see a PR in the repositories with solving problems in a different way - now we are busy with other tasks, changing the logic may lead to new errors, and adding something new takes time. The current solution has been tested and works - the only downside is that copies of the engine take up space. |
I'm getting concurrency exceptions, even when running each thread from a separate working directory.
I'm simply creating 4 working directories and making sure that only one process is running from each of the directories at a time. When a process completes, i allow another thread to start using the previously occupied working directory. Am i supposed to dispose of something before the next proccess can start using the working directory? Occasionally i'm also getting exceptions when a process is starting from a new directory, after it has installed the browser.
|
@victornor judging by the updated comment and the error text, you are using an old version of the engine: working_folder_5\run\FingerprintPluginV8\7cfe4.lock The current version is the tenth, you need to update the library, as I did some fixes for lock files, among other things. |
Thanks, you're correct. I don't know why npm decided to install old versions... As well as this exception on startup.
|
@victornor If you encounter an error related to obtaining an IP address, you can use alternative methods of obtaining it, this is where it was discussed: |
Please consider that we run many instances on the same server however we simply create separate copies of our application. The downside as mentioned is that the bablosoft data folder is large in disk space. But the plus side is we do not have to do any configuring of the working folder. |
Thanks, that works well. It also seems that after updating to the latest version, browser is downloaded and installed every time? |
@victornor the browser will be updated only if the engine version is updated - this happens when a new engine with an updated version of the browser is released, or when other edits are made to the engine management script, but the latter happens less often. Updates for the libraries themselves often occur without updating the engine, so there will be fewer unnecessary downloads and installations. |
Browser downloads and (re)installs happens very often when using different working directories (that has already been used). |
When trying to launch multiple instances (nodejs files) I get
Error: Lock is not acquired/owned by you at C:\Users\username\Desktop\foldername\node_modules\proper-lockfile\lib\lockfile.js:285:43 at LOOP (node:fs:2701:14) at process.processTicksAndRejections (node:internal/process/task_queues:77:11) { code: 'ENOTACQUIRED' }
any idea why?
The text was updated successfully, but these errors were encountered: