puppeteer-sharp icon indicating copy to clipboard operation
puppeteer-sharp copied to clipboard

Deadlocking after reconnect

Open teamothyz opened this issue 6 months ago • 8 comments

Hi all,

I got issue when reconnecting browser. I will call it's deadlock because it doesn't throw any exception, it's stucking.

All of my code are async call

`public async Task ConnectPupperteer(CancellationToken cancellationToken) { await DisconnectPupperteer();

using var wsResponse = await _localClient.GetAsync($"http://{DebuggerAddress}/json/version", cancellationToken);
var wsContent = await wsResponse.Content.ReadAsStringAsync(cancellationToken);
var wsAddress = wsContent.Get("webSocketDebuggerUrl");
var browser = await Puppeteer.ConnectAsync(new()
{
    BrowserWSEndpoint = wsAddress,
    ProtocolTimeout = 10000,
});
var pages = await browser.PagesAsync();
var page = pages.First(p => p.MainFrame != null);

_browser = browser;
_page = page;

}`

I have no idea on this... anyone faced with this issue? Can you share?

Thank you for creating this library!

teamothyz avatar May 20 '25 11:05 teamothyz

That's quite weird. We use ConfigureAwait(false) across the board, in fact, we have a rule enforcing that. If you have an example please share it.

kblok avatar May 20 '25 13:05 kblok

It's hard to give you an advice without an example.

kblok avatar May 20 '25 14:05 kblok

@kblok do you have any idea for this, sir?

tondongduong78655 avatar May 26 '25 09:05 tondongduong78655

Could you try with async disposal instead of Dispose()?

kblok avatar May 26 '25 12:05 kblok

Closed due to inactivity. Feel free to reopen it if needed.

kblok avatar Aug 27 '25 14:08 kblok