Skip to content
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

[Bug]: setImmediate stops working randomly in v11.3.0+ after reloading the app #29261

Closed
3 tasks done
sergiou87 opened this issue May 20, 2021 · 11 comments
Closed
3 tasks done

Comments

@sergiou87
Copy link
Contributor

sergiou87 commented May 20, 2021

Preflight Checklist

Electron Version

11.3.0

What operating system are you using?

macOS

Operating System Version

macOS Big Sur 11.3.1 (20E241)

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

11.3.0 11.2.0

Expected Behavior

setImmediate still responds.

Actual Behavior

I haven't managed to get this into a simple sample app. I will try, but wanted to share what happens in GitHub Desktop in case it's clear to someone what the problem is. If you want to reproduce it yourself, you'll need to use the latest beta.

Basically when I start the app, invoking setImmediate works perfectly. However, if I reload the app at some point (pressing Cmd+R from the Dev Tools) and then I start switching between apps, at some point, randomly, setImmediate stops working. It's like the thread/runner/event loop is blocked.

In the video below, which was recorded AFTER I reloaded the app, you see the following:

  1. setImmediate works at the beginning, showing the alert.
  2. Also you see how I get my list of repositories when I click on the top left button.
  3. Then I start switching quickly between the GitHub Desktop window and the Dev Tools, while I show/hide the list of repositories.
  4. At some point, the list of repositories is empty... that means setImmediate doesn't work.
  5. In the console, I try to run exactly the same setImmediate command and I don't get an alert.
electron-setimmediate-bug.mp4

Testcase Gist URL

No response

Additional Information

As you can see, I can't reproduce the issue 100% reliably. I'm quite sure it doesn't happen in 11.1.1, because I've used that one for quite a long time. However, I tested what you see in the video with 11.2.0 and 11.3.0 and I couldn't reproduce it.

EDIT: today (8-jun-2021) I managed to repro this behavior in 11.3.0, after 2 weeks using the app intensively. As of today, I'm not sure which version broke this, but seems like 11.4.0 makes it much much easier to reproduce it.

Looking at the release notes of v11.4.0, #27582 is the one that seems more suspicious to me.

I could reproduce it with 11.4.0, 11.4.4 and 11.4.7 (the latest version of v11), but I haven't tested other versions in between, nor anything out of v11 (like v10, v12 or v13).

I'll try to write a Fiddle that reproduces the issue

@sergiou87
Copy link
Contributor Author

I just managed to reproduce this in v11.3.0 after we bumped it in desktop/desktop#12279

No idea for how long the bug has been there, but it seems 11.4.0 made it much much easier to reproduce 🤔

@sergiou87 sergiou87 changed the title [Bug]: setImmediate stops working randomly in v11.4.0-11.4.7 [Bug]: setImmediate stops working randomly in v11.3.0-11.4.7 Jun 8, 2021
@nornagon
Copy link
Member

I assume you're talking about calling setImmediate in the renderer process, not the main process?

@sergiou87
Copy link
Contributor Author

Yes! In this case the problem presents in the renderer thread, in a callback from a ResizeObserver: https://github.com/desktop/desktop/blob/9630999f5e32f9aef4c3a0ae54ba88153aa6b588/app/src/ui/lib/list/list.tsx#L300-L304

I haven't tried if the same happens in the main process, but I can check if that helps.

@nornagon
Copy link
Member

It would be great to check if this happens in 12.x or 13.x, there have been a couple of fixes in this area recently.

@sergiou87
Copy link
Contributor Author

Testing this on 12.x or 13.x is a bit more challenging than expected, since I can only reproduce this behavior in the GitHub Desktop app.

In any case, I tested calling setImmediate from the main process while the app is in this state, and that works. Does that mean anything?

I'm gonna try and debug this a bit more 🤞

@nornagon
Copy link
Member

The main process and the renderer process have extremely different characteristics when it comes to calling Node functions like setImmediate, so I wouldn't take much heart from the fact that it works in the main process.

@codebytere
Copy link
Member

@sergiou87 #28957 was merged into v11.4.5 and fixed some related issues - does this make a difference for your case?

@sergiou87
Copy link
Contributor Author

Nope, I tried up to 11.4.7 and still can reproduce the issue 😞

I just built GitHub Desktop with 13.1.7 and was able to reproduce it too:
image

Again, setImmediate wouldn't work in this case 😕

@sergiou87 sergiou87 changed the title [Bug]: setImmediate stops working randomly in v11.3.0-11.4.7 [Bug]: setImmediate stops working randomly in v11.3.0+ after reloading the app Oct 18, 2021
@sergiou87
Copy link
Contributor Author

An update on this: even though I was 99.99% sure I ran into this bug, at least once, without reloading the app, @nornagon suggested this could be an issue only after reloading the app. Since then I've been trying to reproduce this problem without reloading the app and haven't been able to. So either I never saw this bug without reloading the app, or I reloaded the app and kept it open for a few days before I saw the bug (and at that point, I forgot I reloaded the app).

The latter seems more probable 😅

Thanks to everyone who helped me, and sorry I wasted your time! 😢  I've updated the issue description with this new info.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2022

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2022

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants