-
Notifications
You must be signed in to change notification settings - Fork 760
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
fix: await on browser pool _createpageforbrowser #2860
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure the changes you did are fixing anything? i dont think they will have any effect. did you face this issue yourself? or how are you testing the changes have any effect?
@@ -471,7 +471,7 @@ export class BrowserPool< | |||
|
|||
const browserController = await this._launchBrowser(id, { launchOptions, browserPlugin }); | |||
tryCancel(); | |||
return this._createPageForBrowser(id, browserController, pageOptions); | |||
return await this._createPageForBrowser(id, browserController, pageOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't see how this could have any effect, the method is async, this wasn't an ignored promise (and if it was, the issue was on a higher level)
@@ -451,7 +451,7 @@ export class BrowserPool< | |||
browserController = await this._launchBrowser(id, { browserPlugin, proxyTier, proxyUrl }); | |||
tryCancel(); | |||
|
|||
return this._createPageForBrowser(id, browserController, pageOptions, proxyUrl); | |||
return await this._createPageForBrowser(id, browserController, pageOptions, proxyUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and i am also not convinced this can help, the inner function was also async, returning from inside an async function is enough.
hey @B4nan, since you mention the browser hangs due to difficult-to-reproduce the potential cause can be multiple asynchronous calls interfering and instead of |
the indents are messed up, please fix that so the git diff is readable |
Hey @B4nan, can you send a screenshot of the messed-up indents in the git diff? I'd like to see what it looks like on your end. |
now i see you reformatted a lot of unrelated things. please revert all the formatting changes. |
I made three commits: first for await, second for fixing concurrent calls, and third for fixing the indentation issue. Which one do you want me to revert? |
All formatting changes. You reformatted the whole file, none of those changes are relevant to what you are trying to fix, so please revert them. The PR diff needs to stay clear so I can see what you actually changed. Note that we use biome in this repository, its enough to run |
I’ll revert all the formatting changes and make sure to follow the rules using Biome. heads-up for pointing out |
I'm still seeing all the formatting changes in the diff, so it's hard to determine if there have been any other changes besides the fix I applied locally. But the await line commented on by @B4nan is the change that I made that resolved the race condition with newPage. See my longer discussion on #2789 for further details. |
This PR fixes an issue where BrowserPool could hang due to
_createPageForBrowser()
returning a Promisewithout being awaited. By explicitly awaiting this function in both
newPage
andnewPageInNewBrowser
,we prevent race conditions that could cause browsers to remain stuck.
Changes:
await
to_createPageForBrowser()
try-catch
for better error handlingFixes #2789