MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2

Home Page:https://aka.ms/webview2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Problem/Bug]: Recent WebView2 runtime update causes WebView2 session to freeze for 15 seconds

kirwan-safesurfer opened this issue · comments

What happened?

A recent update to the WebView2 runtime is causing a WebView2 session in my app to become inoperable at a specific stage of being in use. This takes place when my WinUI 3 app opens a WebView2 session (for my web app). I first noticed this with runtime version 124.0.2478.67, but it could be possible that the regression was first introduced with runtime version 124.0.2478.51. This is not reproduceable in the Edge app, only the runtime. The following video demonstrates the regression, causing a freeze in my web app for 15 seconds:

safesurfer-webview2-regression.mov

The next time I open the app and try again, the same freeze has a duration of only two seconds. The following video demonstrates the same process with no freezing, as per runtime version 123.0.2420.65:

safesurfer-webview2-working.mov

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

124.0.2478.67

SDK Version

1.0.2210.55

Framework

WinUI3/WinAppSDK

Operating System

Windows 10, Windows 11

OS Version

22631.3447

Repro steps

(Please see videos.)

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

123.0.2420.65

AB#51402837

  • Was you able to find what wv2 API is called "at specific stage of being in use", when it hangs?
  • Do you see any new crashes in Crashpad folder after the repro?
  • Can you repro it with our Sample app?

I appear to have the same problem and have found that is related to how I am initialising the Webview.

StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
var path = Path.Combine(localFolder.Path, "WebView\\"+webViewIndex);

Directory.CreateDirectory(path);
var env = await CoreWebView2Environment.CreateWithOptionsAsync(null, path, null);
webView = new WebView2();   
await webView.EnsureCoreWebView2Async(env);
webView.Source = new Uri(options.Environment.Url);
webViewFrame.Content = webView;

When I do a standard initiation not using CreateWithOptionsAsync the problem doesn't happen.

webView = new WebView2();   
await webView.EnsureCoreWebView2Async(env);
webView.Source = new Uri(options.Environment.Url);
webViewFrame.Content = webView;

I haven't tried any other combination yet, such as passing valid values as parameters 1 and 3 instead of null etc but I will.

@ichijikuibo I have tried to create wv2 in our .net sample app with:

var env = await CoreWebView2Environment.CreateAsync(null, path, null);
await webView.EnsureCoreWebView2Async(env);

and it creates wv2 without delays.

With your repro do you see the same freeze as reported for 15 seconds and it started to happen with 124.0.2478.x?
Which line of your code causes delay for you?
Do you have any env vars or registry keys which affect the logic of which runtime wv2 runtime is used, do you have any prerelease channels installed?

The delay doesn't happen in the code it happens when using the webview, I've done some experimenting tonight and seems that it is because I am changing the user folder if I pass null I get no delays. It seems to happen on the 2nd navigation (1st navigation is load the log in page, 2nd is log in or fail to login) but doesn't happen every time, the page starts to load but there is a delay before it fully loads.

image
The delay happened after loading.gif in this network log
image

There is nothing in the crashpad, I enabled chronium logging but it doesn't seem to be useful, I have tried it on 3 different computers all showing similar results and I am not sure about other webview versions as I have only started this project, I have only used the newest version I can try an older one though. I haven't been working with webview2 for very long so I don't have any prerelease versions installed or any reg/keys or enviroment vars.

Log files
freeze at 215451.txt
no freeze.txt

I will try find a public site tomorrow that has the same behaviour and make a sample project if I can.

I haven't been able to get a consistant situation where it freezes for a long period but I have one where it will freeze everytime, sometimes for 1 second and sometimes for 15+ seconds on the github login screen. The freeze only happens once per application run, if you go back and try again there is no freeze(queueing) at all.

image
The freeze in this case is always between the collect and stats requests in that screen shot, similar to how its always between the same 2 requests on mine.
SampleApp.zip

我们也遇到了同样的问题,我们怀疑是运行时更新导致的。在webview2 Runtime 123.0.2420.97版本正常,更新到124.0.2478.67版本开始出现首次登录卡顿(我们使用了22秒)。最新版webview2 Runtime 版本号125.0.2535.51经过验还是存在同样的问题

We're having the same issue and we suspect it's due to a runtime update. In webview2 Runtime 123.0.2420.97 version is normal, after updating to 124.0.2478.67 version started to freeze on first login (we used 22 seconds). The latest webview2 Runtime version is 125.0.2535.51. The same problem occurs after verification.

@ichijikuibo @wanghan123 Can you please collect and share the etw traces when you repro the issue

@ichijikuibo @wanghan123 Network logs might be helpful as well, please see instructions to capture.

@vbryh-msft @lflores-ms I have an etw trace and network logs do you have an email I can send them too?

We can not repro the issue - but we got the traces, thank you @ichijikuibo. It looks like there should be dump file also generated in <UDF>\EBWebView\Crashpad\reports\ (more about dumps). If somebody who is reproing it and have a dump - could you please let us know

I haven't got anything in that folder have you tried changing the userdata folder? Changing it defiantly makes the problem worse which is why in that screenshot I am on WebViewuserfolder3 in the origional issue I noticed I was loading multiple tabs with all with different userdata folders to isolate the cookies so userdata folder being different than what it was the last time webview was run could be a factor.
image

we have a fix in Canary 128.0.2636.0+. Can folks with repro please verify that it works as expected and there is no freeze?