Skip to content

[Bug]: Asynchronous onBeforeRequest handler crashes Chromium with unretained dangling ptr error for specific websites #42149

Closed

Description

@mgalla10

Preflight Checklist

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.

So far, this issue seems to be specific to https://yahoo.com, but I'm not convinced there aren't other sites out there that would also manifest the same issue.

Testcase Gist URL

https://gist.github.com/0baeefc537a83dc044f4880d9eaeb5c4

Additional Information

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.

Activity

  1. added
    has-repro-gist
    on May 13, 2024
  2. moved this to 👀 Unsorted Items in 30-x-yon May 13, 2024
  3. added
    status/confirmed
    on May 21, 2024
  4. clavin commented on May 21, 2024

    @clavin
    Member

    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.

  5. moved this to 👀 Unsorted Items in 31-x-yon May 21, 2024
  6. moved this from 👀 Unsorted Items to 🛑 Blocks Stable in 31-x-yon May 29, 2024
  7. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 30-x-yon May 29, 2024
  8. clavin commented on May 30, 2024

    @clavin
    Member

    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.

  9. moved this from 🛑 Blocks Stable to 👍 Does Not Block Stable in 31-x-yon May 30, 2024
  10. mgalla10 commented on Jun 11, 2024

    @mgalla10
    Author

    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.

  11. amitparida commented on Jun 14, 2024

    @amitparida

    Same issue: #42505

    Please fix it at the earliest.

  12. self-assigned this
    on Jun 24, 2024
  13. moved this from 👀 Unsorted Items to 🛑 Blocks Stable in 32-x-yon Jun 26, 2024
  14. moved this to 👀 Unsorted Items in 32-x-yon Jun 26, 2024
  15. moved this from 🛑 Blocks Stable to 🛠️ Fixed for Next Release in 32-x-yon Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

30-x-y31-x-ybug 🪲component/webRequestcrash 💥has-repro-gistplatform/windowsstatus/confirmed

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions