You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Asynchronous onBeforeRequest handler crashes Chromium with unretained dangling ptr error for specific websites #42149
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
30.0.3
What operating system are you using?
Windows
Operating System Version
Windows 11 version 23H2
What arch are you using?
x64
Last Known Working Electron version
v29.3.3
Expected Behavior
Providing an asynchronous handler to a window's webContents.session.webRequest.onBeforeRequest method should not result in a crash, regardless of the website being navigated to.
Actual Behavior
If there is any asynchrony in the onBeforeRequest handler (even just a setTimeout(0) delay), attempting to navigate to or within the website "https://yahoo.com" results in Chromium crashing with the fatal error "Detected dangling raw_ptr in unretained with id=0x########". Try-catch blocks are not sufficient to keep this error from tearing down the entire application.
Using the test Gist, once Yahoo has loaded, click the main "yahoo!" button to renavigate to that page again. Within anywhere from 1 to 5 clicks, the entire app will crash and the console will display information about the dangling raw_prt error.
Thanks for the report! I was able to reproduce this on a Windows device, but not on my macOS device. I was able to reproduce this on Electron 30.0.3 as well as Electron 31.0.0-beta.5.
After more testing, I believe this crash occurs on websites that use the Service Worker Navigation Preload feature in such a way that the network request for the navigation preload gets cancelled as soon as possible. I couldn't find any other websites that have this exact setup, nor have the time right now to create a demo, but this should hopefully narrow down the problem space a lot & give clear guidance on what to make an isolated, reproducible test case for.
Any updates on a potential fix or workaround for this? This is starting to impact our ability to develop and test our Electron application since we're seeing this error for more websites, there doesn't seem to be any way to handle or prevent this error, and hitting this error immediately causes our application to close.
Activity
clavin commentedon May 21, 2024
Thanks for the report! I was able to reproduce this on a Windows device, but not on my macOS device. I was able to reproduce this on Electron 30.0.3 as well as Electron 31.0.0-beta.5.
clavin commentedon May 30, 2024
After more testing, I believe this crash occurs on websites that use the Service Worker Navigation Preload feature in such a way that the network request for the navigation preload gets cancelled as soon as possible. I couldn't find any other websites that have this exact setup, nor have the time right now to create a demo, but this should hopefully narrow down the problem space a lot & give clear guidance on what to make an isolated, reproducible test case for.
mgalla10 commentedon Jun 11, 2024
Any updates on a potential fix or workaround for this? This is starting to impact our ability to develop and test our Electron application since we're seeing this error for more websites, there doesn't seem to be any way to handle or prevent this error, and hitting this error immediately causes our application to close.
amitparida commentedon Jun 14, 2024
Same issue: #42505
Please fix it at the earliest.