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

electron renderer process crash #663

Open
YmStrip opened this issue Oct 20, 2024 · 8 comments
Open

electron renderer process crash #663

YmStrip opened this issue Oct 20, 2024 · 8 comments

Comments

@YmStrip
Copy link

YmStrip commented Oct 20, 2024

Describe the bug

when create server in electron render process , youmust close the server before reload the page(or load else page) , if not closed manually, the renderer process will crash without any error message

after that, the page will have a white screen, and a "DevTools was disconnected from the page..." alert will pop up, but it can be close,after closing, press F5 again, and the page will reload, and so on.

Reproducing

const server = new zmq.Reply()
server.bind('tcp://127.0.0.1:65535')
//when the page reload
setTimeout(()=>{
 //if forget to close
//server.close()
location.reload()
},10*1000)

Expected behavior
Tested on

  • OS: [e.g. Ubuntu 18.04, Windows 10] window10
  • ZeroMQ.js version: [e.g. 5.1.0, 6.0.0-beta.2] 6.0.4
@YmStrip YmStrip added the bug label Oct 20, 2024
@aminya
Copy link
Member

aminya commented Oct 20, 2024

Could you try with 6.0.8?
Adding a full reproduction repo would be useful.

@YmStrip
Copy link
Author

YmStrip commented Oct 20, 2024

nodejs 20.12.2 electron 32.0.0, i upgrade to 6.0.8 , the problem still exists , although it is not very serious error and only needs to be close manually, but it was really annoying before.

@diefbell-grabcad
Copy link

diefbell-grabcad commented Nov 13, 2024

We are also having this issue on Electron 12.1.0 (Node 14.16.0) with ZeroMQ 6.1.2 (v5-compat). It is likely caused by how reloading creates a fresh Chromium context but not a new process. As far as I can tell we're closing sockets manually before refreshing and somehow still get the issue.

This comment would indicate that this shouldn't be an issue, however I'm not sure if any cleanup is actually happening when a context closes.

/* This initializer can be called in multiple contexts, like worker threads. */

I'll see about creating a minimal repo to reproduce.

@diefbell-grabcad
Copy link

Repo with bare minimum to reproduce the issue: https://github.com/diefbell-grabcad/ZeroMQ-Electron-Refresh-Crash-Repro

I've even tried to close the socket I've created on window refresh.

@aminya
Copy link
Member

aminya commented Nov 14, 2024

Thanks for the reproduction! That allows me to look into the issue.

@diefbell-grabcad
Copy link

I've found that opening a socket isn't even required to cause the crash, just importing zeromq is enough to cause the crash. I've updated my repo accordingly.

@diefbell-grabcad
Copy link

On ZeroMQ v5, importing zeromq and even leaving a socket open doesn't cause the crash, however leaving a socket connected does cause a crash. We could of course leave it to the user to make sure they disconnect, however I think that ideally ZeroMQ should be more resilient than that.

This of course doesn't answer the issue of why v6 fails just from import alone.

@diefbell-grabcad
Copy link

Created PR for this: #678
@YmStrip could you please test if this works for you? If you can be bothered with the faff of building ZMQ locally

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

3 participants