First CreateCoreWebView2ControllerAsync intermittently blocks about 5 s in ProfileNetworkContextService::ConfigureNetworkContextParamsInternal (component updater)
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- csharp, web-dev
- 領域
- backend, performance
調査の方向性
Start with the startup trace on the browser main thread at ProfileNetworkContextService::ConfigureNetworkContextParamsInternal; compare a stalled launch with a fast one and inspect the 4.99 s blocking call. Use the provided .NET repro and compare runs with and without --disable-component-update. Done means identifying and addressing the intermittent delay while retaining the required component updater behavior.
索引モデルが issue の本文から書いたものです。
説明
What happened?
The first CreateCoreWebView2ControllerAsync of a browser process sometimes takes 5.4–7.7 s instead of the usual 0.3–1.7 s. There is nothing in between: a launch is either fast or about 5 s slower. Later controllers in the same process are fast (0.1–0.3 s).
A startup trace (--trace-startup) of a slow launch shows the browser main thread in a single 4.99 s ScopedBlockingCallWithBaseSyncPrimitives on this path:
ProfileImpl::OnPrefsLoaded
> ProfileImpl::OnLocaleReady
> BrowserContextDependencyManager::DoCreateBrowserContextServices
> ProfileNetworkContextService::ConfigureNetworkContextParamsInternal
> ScopedAllowBaseSyncPrimitivesOutsideBlockingScope
> ScopedBlockingCallWithBaseSyncPrimitives (4.99 s)
The constant length suggests a timed wait with a 5 s timeout. The fast launches' traces have no long blocking call there.
It happens on new user data folders and on reused ones. It also happens with no other load on the PC, and when the network is unreachable (a dead --proxy-server). --disable-component-update almost removes it. We can't ship that switch, because our users need the updater's components: revocation lists, SmartScreen data and the tracking-prevention lists.
Measured with the repro below (first controller; a launch counts as stalled at more than 3 s):
| Launch | Stalled |
|---|---|
| New user data folder | 14 / 35 (40%) |
| New user data folder, PC otherwise idle | 5 / 12 |
| Reused user data folder, later launches | 17 / 141 (12%) |
| Reused folder whose components finished installing (5 min first session) | 8 / 29 |
| New folder, unreachable network (dead proxy) | 3 / 12 |
New folder, --disable-component-update |
1 / 12 |
Folder first opened with --disable-component-update, next launch without it |
6 / 12 |
Stalls cluster in time: several launches in a row stall, including on different user data folders. A given folder isn't consistently slow or fast.
The effect on our app: a window shows promptly but stays empty for about 6 s instead of about 1 s. That happens on 4 in 10 first launches and about 1 in 8 later launches.
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
156.0.4314.58
SDK Version
1.0.4258.31
Framework
WinUI3/WinAppSDK. The app hosts controllers in a plain Win32 window; the repro below uses WinForms and shows the same behaviour.
Operating System
Windows 11
OS Version
10.0.26300
Repro steps
- Build the program below (.NET 9,
net9.0-windows,UseWindowsForms, packageMicrosoft.Web.WebView21.0.4258.31). - Run it about 20 times, each time with a new empty user data folder. Wait for the browser process to exit between runs, so the next run can't attach to it.
- Read
controllerMsfrom each run. Roughly a third to a half of runs are about 5 s slower than the rest. - Run it again on one of those folders 20 or more times: about 1 in 8 runs stalls the same way.
- Add
--disable-component-updateas the arguments: the stalls almost disappear.
using System.Diagnostics;
using Microsoft.Web.WebView2.Core;
// argv: userDataFolder [additionalBrowserArguments]
internal static class Repro
{
[STAThread]
private static void Main(string[] argv)
{
ApplicationConfiguration.Initialize();
var form = new Form { ShowInTaskbar = false, Size = new Size(800, 600) };
form.Load += async (_, _) =>
{
var options = new CoreWebView2EnvironmentOptions(argv.Length > 1 ? argv[1] : "");
var environment = await CoreWebView2Environment.CreateAsync(null, argv[0], options);
var controllerOptions = environment.CreateCoreWebView2ControllerOptions();
controllerOptions.IsInPrivateModeEnabled = true;
controllerOptions.ProfileName = "repro";
var clock = Stopwatch.StartNew();
var controller = await environment.CreateCoreWebView2ControllerAsync(form.Handle, controllerOptions);
Console.WriteLine($"controllerMs={clock.ElapsedMilliseconds} browserPid={controller.CoreWebView2.BrowserProcessId}");
controller.Close();
form.Close();
};
Application.Run(form);
}
}
To see where the time goes, add --trace-startup --trace-startup-duration=10 --trace-startup-file=<path> and open the trace in ui.perfetto.dev. Look for ConfigureNetworkContextParamsInternal on the browser process's main thread.
Our measurements also used a custom scheme registration and a second, non-InPrivate profile. Neither changes the result: the stall is on the first controller only.
Repros in Edge Browser
Not tested.
Regression
Don't know
Last working version (if regression)
(blank)
Startup traces of a stalled and a fast launch are available on request.
- 主要言語
- PowerShell
- スター
- 526
- フォーク
- 70
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MicrosoftEdge/WebView2Feedback のほかの issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
MicrosoftEdge/WebView2Feedback#5749 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
MicrosoftEdge/WebView2Feedback#5798 ·
-
[Problem/Bug]: Runtime 157 suppresses <input type="file"> in Outlook add-in task panes ("top-level window size is smaller than the minimum required size (400x300)")対応中かも @ambikakunnath が 1 日前に担当しました。 オープンregression
MicrosoftEdge/WebView2Feedback#5797 · 担当者 1 名 ·
-
[Problem/Bug]: PDF viewer fails on inline page dictionaries in /Kids; standalone WPF reproductionオープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
MicrosoftEdge/WebView2Feedback#5795 · コメント 2 件 ·
-
[Problem/Bug]: Standalone Microsoft Edge 156.0.4314.58 (stable) still triggers a failed interactive logon (4625, 0xC000006A) per new headless browser root process and can lock a local Windows account (4740); WebView2 156 fix does not cover it対応中かも @prija-microsoft が 2 日前に担当しました。 オープンregression
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
MicrosoftEdge/WebView2Feedback#5794 · 担当者 1 名 ·
MicrosoftEdge/WebView2Feedback の issue をすべて見る
似ている issue
-
govulncheck reports 7 reachable vulnerabilities in dependencies対応中かも @dwisiswant0 が今日担当しました。 オープンType: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
projectdiscovery/rawhttp#558 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
MasterJ93/ATProtoKit#344 ·
-
backend bug frontend good first issue p1
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
go perft exits when EvalFile is unavailable対応中かも @Muawiya-contact が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
official-stockfish/Stockfish#7292 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/accelerate#4511 ·
メンテナーはふだん 1 日以内に返信