Skip to content
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

Random Quiet Abends using WebBrowser2 #2627

Closed
Lassesen opened this issue Jul 26, 2022 · 8 comments
Closed

Random Quiet Abends using WebBrowser2 #2627

Lassesen opened this issue Jul 26, 2022 · 8 comments
Assignees
Labels
bug Something isn't working status-circle back Check back after requesting general information.

Comments

@Lassesen
Copy link

Description
I have a WinForm application in C# that walks web sites (i.e. a web crawler). Logging performance, http code, sizes etc.

At random will will just die, no error message. I have built a resume on last work not done into the application and it proceeds fine.
In some cases, it will run for less than 100 pages before dying, in other cases almost 10,000 (on the same web site). So it does not appear to be a content issue.

The main issue is that the death is totally quiet,

Version

  <package id="log4net" version="2.0.14" targetFramework="net472" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.9" targetFramework="net472" />
  <package id="Microsoft.AspNet.Razor" version="3.2.9" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.9" targetFramework="net472" />
  <package id="Microsoft.Web.Infrastructure" version="2.0.0" targetFramework="net472" />
  <package id="Microsoft.Web.WebView2" version="1.0.1264.42" targetFramework="net472" />
  <package id="System.Configuration.ConfigurationManager" version="6.0.0" targetFramework="net472" />
  <package id="System.Security.AccessControl" version="6.0.0" targetFramework="net472" />
  <package id="System.Security.Permissions" version="6.0.0" targetFramework="net472" />
  <package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net472" />
  <package id="System-Web-Helpers.dll" version="1.0.0" targetFramework="net472" />

Repro Steps

{
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += ThreadException;

            // Set the unhandled exception mode to force all Windows Forms errors to go through
            // our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Add the event handler for handling non-UI thread exceptions to the event.
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            try
            {
                Application.Run(new Form1());
            }
            catch (Exception exc)
            {
                log.Error(exc);
            }
        } )

image

Additional context

@Lassesen Lassesen added the bug Something isn't working label Jul 26, 2022
@aluhrs13
Copy link
Contributor

@Lassesen - Are you listening to WebView2's ProcessFailed event at all? If WV2 is crashing that would give you an error code and other information for us to look at.

@Lassesen
Copy link
Author

Yes, I am -- I went on an event linking marathon trying to resolve it, to no avail.

I have a workaround, a CMD file doing an infinite loop that picks up from SQL the next item to walk... so when it dies, it restarts and resumes...

  private void Edge_ProcessFailed(object sender, CoreWebView2ProcessFailedEventArgs e)
        {
            listBoxEvents.Items.Add("Edge_ProcessFailed");
            RecordError($"[190] {e.ProcessFailedKind}:{e.Reason}:{e.ProcessDescription}:{e.ExitCode}\t{_requestNumber}\t{edge.Source.AbsoluteUri} ");
            MarkRequestDone();
        }

@aluhrs13
Copy link
Contributor

That's really odd - And you're using the same WV2 for all of this (assuming it doesn't disappear) or are you making a new WV2 for every URL you crawl?

Are there any files in the \EBWebView\Crashpad\reports folder of your app's user data folder?

@Lassesen
Copy link
Author

Lassesen commented Jul 28, 2022

I am using the same WV2 (I am crawling a site that requires sign on and uses session variables)
Yes there are, I have zipped the entire folder.
image

(edited by Andy to remove the files that might have sensitive information)

@aluhrs13
Copy link
Contributor

You're hitting an out of memory error, without more details of what's happening in the loop it's hard to tell exactly what's causing it. Would you be willing to share the source with me? (can take this offline in email, aluhrs at microsoft.com) Memory leaks in a platform like WebView2 are hard to track down and reproduce, so if you're hitting something in our code that's causing this that would be REALLY helpful and could help a lot of other apps in the process.

@Lassesen
Copy link
Author

Sending you a zip file. You should be able to adapt it.

@Lassesen
Copy link
Author

Lassesen commented Sep 1, 2022

As a FYI on my prior issues. The problems I encountered were only when running from visual studio (i.e. debug). It runs stable for 96+ hrs when executed from the build image without Visual Studio

@aluhrs13
Copy link
Contributor

Sorry for not following up, I was out of office for a few months soon after this.

I wasn't able to repro with what you shared, and it seems like it might be related to debug build which is likely out of our control. Will close in ~7 days unless you disagree.

@aluhrs13 aluhrs13 added the status-circle back Check back after requesting general information. label Aug 10, 2023
@aluhrs13 aluhrs13 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status-circle back Check back after requesting general information.
Projects
None yet
Development

No branches or pull requests

2 participants