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
Renderer Node fs API stops working on page reload when allowRendererProcessReuse is true #22119
Comments
In my own code, if I have Swapping to On Win10, electron 8.0.2. Node 12.3.1. EDIT: Upon further testing, using any promise based fs method locks the renderer. It also looks like electron 8.x uses Node 12.13.0; once I'm able I'll test with a more up-to-date version of node. |
I recently started updating all my project's dependencies, and I found the same behavior. When updating to electron 6.0.0 or newer, setting However, the issue #19554 never happens to me (my config is based on Electron-Vue: https://github.com/SimulatedGREG/electron-vue/blob/master/template/src/main/index.js) Environment: Electron 6+, Windows 10 (1903), Node 12.16.1 (LTS) |
I'm probably going to move the stuff I was using fs for to the main process anyway, but is there any reason this shouldn't work? Maybe some handles aren't getting closed? |
This fixes this issue: electron/electron#22119 This commit will be reverted once the issue on electron is fixed.
This fixes this issue: electron/electron#22119 This commit will be reverted once the issue on electron is fixed.
With the official release of v9.0.0, I have the feeling that with the default changed, we can anticipate a lot of electron apps run into this weird bug that would cause the developers hours of headache on why their fs promises/callbacks never resolve. I have personally spent over 5 hours before concluding the issue was So... just want to give it a bump. I think it's fair to be low priority while Thanks again for all this amazing work! |
I just upgrade to 9.0.0 and encountered this issue. In my case a call to fs worked, but a call to zlib hung indefinitely, and when I did a page refresh in dev tools the call returned, but then React error statements flooded my console:
At this point the page was locked up and I had to terminate the process. I couldn't get this to happen all the time, but was able to reproduce about half the time. When I set I know I'm not providing enough info to properly debug this issue, just adding my experience to the thread. |
Agree with this, just spent a while trying to diagnose this issue. |
I'm fairly confident that I'm banging my head up against this one also. I've got |
@sofianguy any chance this issue can get a new look in terms of prioritization? I'm specifically referring to my previous comment here to justify #22119 (comment) Also happens on Electron 9.x.y |
Funny, i had this same issue yesterday #24073 and it was closed prematuraly ;-;
For me, i think the callbacks are called to the previous renderer, so if i reload a page or go to another one the page is strangely still connected to the previous renderer process. I mean, there's no error, everything is ignored in the callback function, so i don't see any other explanation than that... right? |
Just updated from electron 8 to 9. Spent 2 days trying to figure out why my https requests (using node's https module) would never return after refreshing from the dev console. Surprisingly, doing some hacky I see electron 11 plans to |
I think there has to be some other underlying issue, otherwise this would be more widespread. I'm just not sure what causes this condition. |
not exactly this issue, but a related one here |
Still reproducible in the latest Electron versions #24173 |
I just ran into what I believe is this same issue, but not with the Node API. I have an Angular 10 app running, and after upgrading to Electron 9, I found that after refreshing, the Developer Tools showed a message saying it was disconnected, and my page would be pretty much blank. Refreshing again would cause the page to appear somewhat, but all of my database queries (Knex with sqlite3) would hang. I determined Electron 9 was the issue and then guessed and found that setting It's possible under the hood there are the Node API is being used, I suppose, but for me it was the promises from Knex never resolving. |
Refs: - electron/electron#22119, - electron/electron#18397, and - electron/electron#21287 Signed-off-by: Akos Kitta <kittaakos@typefox.io>
@codebytere, I still see the issue in the release 10.1.3 |
@remss do you have a reliable repro? The one in this issue no longer occurs for me 🤔 |
@codebytere I can repro the dupe closed issue. Pasting repro below: main.js:
firstPage.html:
firstPage.js:
secondPage.html:
secondPage.js:
|
I can sadly confirm the dupe #25311 isn't fixed in 10.1.3 either (don't have a reproducible gist.) |
Thanks! Will keep digging |
I can confirm the issue is not resolved with 10.1.3. I managed to reproduce the issue with those steps:
const fs = require("fs");
let counter = 0
const counterInterval = setInterval(() => {
document.body.innerText = `Attempting to read README.md file... (${++counter}s)`
}, 1000);
fs.readFile("README.md", (err, data) => {
if (err) {
document.body.innerHTML = `An error occured: ${err}`
return
}
document.body.innerHTML = `Got content of README.md:<br><pre>${data.toString()}</pre>`
clearInterval(counterInterval)
}) Now when starting the app, the content of |
On which operating system @Seblor? I ran https://gist.github.com/f56fde13e73569b3b9f5b7cc6edde1b7 and still could not reproduce on macOS. |
@codebytere I used your exact files and still have the error when reloading the app. I ran it on Windows 10 (2004), Node 13.8.0 and Electron 10.1.3. Tell me if you need more info, and thanks for looking into this issue. |
@Seblor success! i was on macOS - it seems now to be more specific to Windows. Additionally, this seems more specific to the async call - if i swap |
As an update for all who run into this - we recognize this bug is a blocker for many and do not plan to remove |
Fix is up at #25869, folks! |
@codebytere is it Windows-only based on the title or all platforms? 🤞 |
@KishanBagaria the issue was most prominent on Windows but this fix should ameliorate issues cross-platform! I'll update the title actually. |
Looking forward to testing it. Thanks already for working on it @codebytere! |
Update: it was a problem with my VM. Now it works, thanks @codebytere! |
Haven't seen this issue occur since Electron 10.1.4. Definitely has reduced if anything. |
@codebytere After many many sessions of debugging I found a repro (I'm on Windows 10):
|
Preflight Checklist
Issue Details
When setting
app.allowRendererProcessReuse = true
and after reloading the renderer (Ctrl+R
in developer console), Nodefs
APIs would randomly stop working. Specifically, the callbacks are never called, or if you're usingfs.promises
, the promises are never resolved.An interesting observation is: when you reload again, for a brief moment before the page is refreshed, the previous
fs
calls are magically unblocked. This can be observed byconsole.log
lines suddenly printing the moment you hitCtrl+R
which disappears quickly as the whole page reloads.Possibly related: #19554 This issue sounds like the opposite of what's happening here.
Also note: issue does not present itself when
app.allowRendererProcessReuse = false
Expected Behavior
From the repro steps, expecting to see local files printed in the console:
Actual Behavior
List is printed the first time the app loads. Hit Ctrl+R and observe only a few lines printed, or none at all. Hit Ctrl+R again and observe more lines printed for a split second before renderer reloads.
To Reproduce
Clone https://github.com/electron/electron-quick-start
rendereer.js
main.js
Screenshots
First boot:
On reload:
Additional Information
The text was updated successfully, but these errors were encountered: