-
Notifications
You must be signed in to change notification settings - Fork 15k
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
Unclear how appData/userData folder behaves with multiple Electron instances #4727
Comments
Chromium doesn't have good support for running two instances at the same time, most resources are guarded with file locks, like localStorage, so if you are using localStorage in one instance the accesses in other instances will be refused. And for resources that are not guarded by locks, race conditions might happen and it would be very bad. |
@zcbenz but would you say that the appData folder is mainly used for renderers and that it is somewhat safe to have 2 instances of the main process running at the same time as long as they dont both open windows? |
Yeah under that condition it should be OK. |
@zcbenz another question: do you think it is possible to migrate the app data folder to another location? I am wondering at which time Electron/Chromium expects the app data folder to be there, e.g. is there a way to do this operation (even if it takes 1 second) before this folder is needed? |
@zcbenz actually I did a small experiment and it seems to me that the appdata folder is empty as long as no window is opened, after that, I see the following folders created: GPUCache, Local Storage. So I would assume I could do the migration before any window opens. |
The other question is if these folders are fit to be moved to another location or not... |
@bpasero As long as you call |
Allright, thanks for the pointer to the other issue. |
Ok so if I am spawning multiple instances of Electron via multiple simultaneous instances of a Node script that runs Nightmare, then this may explain why the scripts don't execute properly? E.g. Works fine with one spawned process, more than one and Nightmare renderer actions don't work reliably. |
This is more a question or ask to update docs, not an issue: When using Electron, all of Chromes configuration files end up in appData (e.g. local storage, indexdb). It is not clear to me if it is OK to have 2 instances of Electron running at the same time both sharing the same appData folder.
In the past I have seen at least one case where this was not possible: Using IndexDB seems to lock the appData folder so that a second instance is not fighting over the IndexDB resources. This seems like a valid thing for IndexDB to do.
However, in which cases is it OK to have multiple instances on the same appData folder and when should it be prevented? Imagine the second instance is not spawning a renderer process and is just there to talk to the "main" instance via some ipc mechanism. Would the appData folder still have resources that both instances would fight over?
The text was updated successfully, but these errors were encountered: