mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
IPC appears to be broken on Windows #257
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @richardpartridgeflynet on GitHub (Jan 14, 2019).
Originally assigned to: @GregorBiswanger on GitHub.
Hi,
I'm working on a proof of concept (Windows not Linux/Mac) prior to us using Electon.NET in an upcoming project and I'm having an issue with the IPC between the main and renderer processes. I can get the IPC working but only very briefly, after a little time messages like this will begin scrolling up the console:
These messages are generated about every 30s until the program is closed. Once the first of these messages has appeared, IPC between the main and rendered processes stops.
Please note that I raised a very similar issue (number 12) on the electron.net-api-demos project. This issue was closed because the demos code was not created with the latest version of the Electron.NET API but I don't think that explanation applies to this issue.
Here's a minimal set of instructions that should let you reproduce the issue starting with a clean Win 2012 R2 VM:
Install dotnet-sdk-2.2.102 (issue also shows up with sdk 2.1)
Install Node 10.15.0 LTS
Create a new app with dotnet new mvc
Install ElectronNET.API 0.0.11
Install ElectronNET.CLI 0.0.11
Add some basic IPC between main and rendered processes, I copied the code Gregor added in his Getting Started video on YouTube
Start the app and try out the IPC, note that it works. Leave the app for a while until one of the BridgeConnector messages appears, re-try the IPC and note that it no longer works.
Note that you may have to edit the Views\Shared_Layout.cshtml file to remove the integrity="..." attributes from the tags as Electron doesn't handle those well.
Please let me know if you have any suggestions as to what might be going on or if you need any more info to help diagnose the issue.
Thanks,
Richard
@herefishyfish commented on GitHub (Jan 15, 2019):
I'm getting this too. Any points in the right direction would be amazing.
@GregorBiswanger commented on GitHub (Jan 15, 2019):
Hi,
this is unfortunately a known problem: #106
When the connection is rebuilt, all event listeners are lost. I need a solution with Socket.IO.
@richardpartridgeflynet commented on GitHub (Jan 15, 2019):
Hi Gregor,
I should probably have been clearer when I raised this issue, when I said 'Leave the app for a while' I meant leave it for a minute, two at the most rather than a long period such as overnight.
I guess the question is what causes the connection to be rebuilt after such a short period and every 30s thereafter?
Regards,
Richard
@richardpartridgeflynet commented on GitHub (Jan 15, 2019):
Hi Gregor,
Below is the console output from my app (detailed above). From the timestamps you can see that the connection messages appear roughly 30s apart. The stdout: ping messages are from my IPC code. There is also a message about window-all-closed listeners near the end, does that provide any insight?
Regards,
Richard
@theiviaxx commented on GitHub (Mar 12, 2019):
I also get this, though not on this cadence. it will just happen at some point in the application lifetime, i cant seem to narrow it down to a specific event.
Im not sure if this is the wrong way, but is there something i can do on the asp side to "re-connect" everything?
@timothyparez commented on GitHub (Mar 20, 2019):
I get the same issue on Ubuntu 16.04
So the classic example of opening a dialog, on one end I have:
and on the other end:
If I start the application and do not click that button the disconnect will happen
about 30 seconds after the window has loaded.
ASP.NET Core Application connected... global.electronsocket cZPwH6dBGyb8MFdrAAAC 2019-03-20T07:33:23.882ZHowever, if I click that button as soon as the window has loaded, the dialog is shown,
and I can show it multiple times without any issues. I can even let it sit there for 10 minutes
click it and it will still work.
So it seems that once that initial "contact" has been made the connection is kept alive.
Edit: I have determined that in my case the disconnect happens because the "server" side was doing a lot of work at startup (service instances being created for dependency injection). This does not take away the issue of course, but thought it might be good to mention (and I should update my design)
@pedromrpinto commented on GitHub (Apr 22, 2019):
I had a similar issue. Everytime the socket reconnects Tray, Globalshortcuts, etc, lose the concat between js and C#. The pull request #233 (FIX application hangs after socket reconnect) shoud fix that problem.
@theiviaxx commented on GitHub (May 6, 2019):
@pedromrpinto I am using your PR changes and so far so good 👍 It does report the Bridge disconnect message, but everything still works as expected
@raloverafs commented on GitHub (May 8, 2019):
We're having @richardpartridgeflynet 's issue as well. When will we be able to update to a release with @pedromrpinto 's PR? Thanks
@GregorBiswanger commented on GitHub (May 16, 2019):
Fixed! Big thanks to @pedromrpinto!
The next few days will be the next big Electron.NET update released.
@dafergu2 commented on GitHub (Sep 27, 2019):
@GregorBiswanger I'm still getting these messages in the log. Functionality still seems to be working, but I'm a bit concerned about the msg:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 window-all-closed listeners added. Use emitter.setMaxListeners() to increase limitIs this a false positive or is there something that needs to change to prevent a leak? I'm more than happy to debug.
I'm running with .net core 3.0.0.