electron / electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
https://electronjs.org
MIT License
114.19k stars 15.4k forks source link

[Bug]: "TypeError: e.sendReply is not a function" when calling ipcRenderer.sendSync/invoke #36558

Open ArnonAsquira opened 1 year ago

ArnonAsquira commented 1 year ago

Preflight Checklist

Electron Version

12 - 22

What operating system are you using?

Ubuntu

Operating System Version

18

What arch are you using?

x64

Last Known Working Electron version

11

Expected Behavior

Sending messages via the ipcRenderer's sendSync/invoke methods should work consistently, and not throw unexpected errors.

Actual Behavior

When using sendSync/invoke a certain amount of times an error is thrown which crashes the app: "TypeError: e.sendReply is not a function" when calling ipcRenderer.sendSync/invoke

Testcase Gist URL

No response

Additional Information

This bug can be easily reproduced in versions 12 - 22, by setting an interval in the preload script, which calls sendSync/invoke, and listening and returning a value in the main module.

in preload: setInterval(async() => { ipcRenderer.sendSync('TRIGGER_SEND_REPLY'); ipcRenderer.invoke('TRIGGER_HANDLE'); }, 10);

in main: ipcMain.on('TRIGGER_SEND_REPLY', (ev) => { try { ev.returnValue = ''; } catch(err) { console.log('error occured on TRIGGER_SEND_REPLY') } });

ipcMain.handle('TRIGGER_HANDLE', () => { return ''; })

github-actions[bot] commented 1 year ago

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!

boutetnico commented 1 year ago

bump

github-actions[bot] commented 1 year ago

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!

boutetnico commented 1 year ago

bump

electron-issue-triage[bot] commented 1 year ago

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!

boutetnico commented 1 year ago

bump

electron-issue-triage[bot] commented 10 months ago

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!

Jelmerro commented 10 months ago

still an issue

asd281533890 commented 7 months ago

This issue still exists in version 22.3.24, but there is no stable way to reproduce it. It seems that this problem will occur whenever a specific webpage is loaded.

electron-issue-triage[bot] commented 4 months ago

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!

Jelmerro commented 4 months ago

still an issue

electron-issue-triage[bot] commented 1 month ago

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!

Jelmerro commented 1 month ago

still an issue

Edw1nkql commented 1 month ago

bump

Edw1nkql commented 1 month ago

In which version was this issue resolved? I'm using Version 20.3.8 now.