Skip to content

[Problem/Bug]: RetryCreateWebView is invoked during CloseInternal and causes a shutdown crash #5725

Description

What happened?

We observed a crash during application shutdown while closing a WebView2-based browser instance.

The relevant call stack is:

EmbeddedBrowserWebView::RetryCreateWebView + 0x13b
EmbeddedBrowserWebView::CloseInternal + 0x282
EmbeddedBrowserWebView::Controller::Close + 0xaf
TaskSyncWindow::Destroy + 0x2f

The unexpected behavior is that RetryCreateWebView is entered from the controller close path. During the same shutdown sequence, a creation-related callback is dispatched and the process crashes.

Questions for the WebView2 team

  1. Under what conditions can CloseInternal or Controller::Close trigger RetryCreateWebView?
  2. Can a retry-create operation run while a WebView2 controller is being closed or destroyed?
  3. Can this happen when controller creation is still pending or when an asynchronous creation callback is already queued?
  4. Can closing a controller synchronously dispatch a controller-created or browser-created callback?
  5. Are callers required to cancel pending creation operations or drain callbacks before calling Close?
  6. Is there a documented shutdown sequence that prevents a pending create operation from retrying during close?
  7. Could this indicate a re-entrant close/create race in the wrapper or task-dispatch layer?

Observed sequence

  1. Application shutdown begins.
  2. A browser/controller close operation is requested.
  3. The close path enters CloseInternal.
  4. RetryCreateWebView is entered unexpectedly.
  5. A creation-related callback is dispatched during the close/destruction sequence.
  6. The process crashes in the callback path.

Expected behavior

Once controller shutdown has started, no new WebView2 creation or creation retry should be initiated, and no creation callback should access an object that is being destroyed.

Environment

  • Runtime channel: Stable WebView2 Runtime
  • WebView2 Runtime version: Not currently available
  • WebView2 SDK version: Not currently available
  • Framework: Native C++ wrapper
  • Operating system: Windows
  • Occurrence: Application/process shutdown
  • Reproducibility: Intermittent

No application-specific source code is included in this report. We can provide a privately shared minidump or additional lifecycle logs if needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions