Skip to content

[Problem/Bug]: launching DevTools concurrently with ExecuteScript leads to deadlock #5255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
otakubeam opened this issue May 26, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@otakubeam
Copy link

otakubeam commented May 26, 2025

What happened?

Describe the bug
When attempting to launch the DevTools window (OpenDevToolsWindow) concurrently with executing a script (ExecuteScript) in a WebView2 Win32 C++ application, the application enters a deadlock state. Neither the DevTools window opens nor the script is executed. This occurs consistently when the two operations are triggered (consecutively, ExecuteScript after OpenDevToolsWindow).

Expected behavior
Both operations should complete successfully: the DevTools window opens, and the script executes without blocking each other.

Actual behavior
The application deadlocks indefinitely. The main UI thread calling waiting for ExecuteScript hangs and so does the webview2 thread calling OpenDevToolsWindow, requiring the application to be terminated forcefully.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

136.0.3240.92

SDK Version

1.0.1661.34

Framework

Win32

Operating System

Windows 10

OS Version

19045.5608

Repro steps

Steps to reproduce

  1. Create a WebView2 environment and controller.
  2. Load a webpage or HTML content into the WebView2 control.
  3. Trigger OpenDevToolsWindow and then right after that ExecuteScript.
  4. Observe that neither action completes: the DevTools window appears empty and transparent, and the script is not executed (left hanging waiting the result from the callback).

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

@otakubeam otakubeam added the bug Something isn't working label May 26, 2025
@otakubeam
Copy link
Author

The issue seems to stem from the fact that in our architechture browser window communicates with the parent window, while the parent is blocked on the script execution waiting for the result.

Making the browser backing window not a child of the main UI window seems to resolve that, though there are still some complications such as the need to manually track parent window position and size,manually closing the window, etc. Basically all the stuff that being the child window handles automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants