electron: [Bug]: "TypeError: e.sendReply is not a function" when calling ipcRenderer.sendSync/invoke
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
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 ‘’; })
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 17 (2 by maintainers)
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.