Use Page.DisposeAsync and Browser.DisposeAsync hang forever
See original GitHub issueBefore you file a bug, have you:
-
Tried upgrading to newest version of PuppeteerSharp, to see if your issue has already been resolved and released? Yes, I am using the latest version.
-
Checked existing open and closed issues, to see if the issue has already been reported? Yes, I do search quite a lots and also try to find solution from the original puppeteer repo also.
-
Tried reproducing your problem in a new isolated project? Not yet, I might try next time but since it’s a production issue, so I need to fix it quickly.
-
Considered if this is a general question and not a bug?. For general questions please use StackOverflow. Not sure but after I change to use
Dispose()
seems these chrome process close correctly.
Description
I am running puppeteer-sharp with docker, I found there are quite a lot of zombie chrome process never be kill. I was try to use tini
as entry point (tips from here tips) also no luck. I was check the logs, I found that some DisposeAsync
sometime never complete. So I change to use Dispose
instead, looks good so far.
Complete minimal example reproducing the issue
There is not complete code right now, I might update later. I just simply to call DisposeAsync
.
E.g.
var options = new LaunchOptions
{
Headless = Configurations.Puppeteer.Headless,
Args = new string[]
{
"--no-sandbox",
"--disable-dev-shm-usage",
"--incognito"
}
};
Browser = await Puppeteer.LaunchAsync(options, loggerFactory);
var browserPages = await Browser.PagesAsync();
if (browserPages.Length > 0) {
Page = browserPages[0];
await Task.WhenAll(browserPages.Skip(1).Select(x => x.CloseAsync()));
} else {
Page = await Browser.NewPageAsync();
}
// some other steps
logger.LogInformation("browser is disposing");
await Page.DisposeAsync();
await Browser.DisposeAsync();
// this log sometime never print out
logger.LogInformation("browser is disposed");
Expected behavior:
Browser dispose correctly, and no zombie process
Actual behavior:
I found some zombie process never be kill
Versions
- Which version of PuppeteerSharp are you using?
- Version: 2.0.3
- Which .NET runtime and version are you targeting? E.g. .NET framework 4.6.1 or .NET Core 2.0.
- netcoreapp3.1, aspnet core mvc
Additional Information
Running puppeteer-sharp in docker, dockerfile similar with the one you provided, I just added tini
as entry-point. (BTW, I think the docker example should also add this and run with args --disable-dev-shm-usage
).
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (5 by maintainers)
Top GitHub Comments
https://github.com/puppeteer/puppeteer/issues/1825
Have found that the following arguments resolved the zombie processes
Args = new[] { “–headless”, “–no-sandbox”, “–disable-gpu”, “–single-process”, “–no-zygote” }
also added this https://github.com/Yelp/dumb-init
still exist this case in new version in puppeteer 8