-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: support shared browser install for concurrent getBinary()
calls
#25
feat: support shared browser install for concurrent getBinary()
calls
#25
Conversation
getBinary()
multiple times + support custom cache
directory
I think it would be great if you were able to enable parallel tests in this PR! |
I suspect the issue is that |
More hanging tests, unfortunate. |
I think I understand what's happening, it's not possible to enable parallel currently because all the tests spawn the browsers on same port 9222, so all the tests conflicts together 😅 |
Oh that's definitely possible, let me see if I can make a PR that dynamically adapts the port. |
I think the way to do is it to let chrome choose the remote debugging port automatically, that's how puppeteer does it: export const CDP_WEBSOCKET_ENDPOINT_REGEX =
/^DevTools listening on (ws:\/\/.*)$/; |
I did this originally, but the issue is that firefox's debug protocol prints a different message. Technically, there are other issues with FF support atm so maybe we just don't care about that for now and come back to it later. FF should be in 0.4.0 if all goes well. |
Maybe it doesn't? I don't remember why I stopped doing that. Weird. I'll just do that. Give me ~5 minutes. |
Still working on it. Turns out this is a slightly bigger refactor than I would have expected 😅 |
@lowlighter merged my PR. Could you try to update your branch? |
I'll rebase it 👍 |
It seems to works on Linux now (don't know for mac os since it gets canceled before the result) |
This usually means that there was an error running the executable and it usually prints out a log. No idea why there isn't a log or why it's failing to boot. Strange. I can test your branch on MacOS right now. |
All tests pass on my Mac. |
It seems I can reproduce on Windows, not sure if it's separate errors, but it may be possible that when spawning the browser there is an exclusive lock that get attached to the DLL so it's not possible to create another instance of it ?
I think I'll check later, thanks for helping and for implementing #26 |
Sounds good. Let me know if you want me to investigate further (though I'd have to obtain a windows computer!). |
I have experimented some last stuff before sleeping, ssems that on Windows for some reason the exit code 21 gets triggered when ran in parallel really quickly It seems to be a "NETWORK_CHANGED" error: The dirty fix I put needs to be removed, it was just for testing the CI. It seems that all tests are "passing", but there are Web socket leaks on windows, I'm not sure where it does occurs. I thought it was maybe in page but apparently it had no effects |
@lino-levan I think there was a potential op leak in celestial bindings related to Websockets So maybe splitting this PR into the following ?
|
Splitting the PRs would be great. Reviewing this (and reverting these changes if need be, as you mentioned), would definitely be a challenge. I appreciate the work! |
Unless you really want to split this PR, outside of my one nit, this LGTM. |
I'll split the PRs if you don't mind 👍 |
Did the three PRs cover this one? Is there more that this PR does? Edit: I guess the locking logic isn't implemented? |
Yeah it's still missing the lock feature, I'll rebase shortly, but I have a design question for you though This pr actually has 2 "lock mechanisms", one promise based and the other lock file based The promise one is intended to limit the download of a same browser to a single one within the same process (calling The lock file has been added because for parallelism in different process, it's not possible to use the promise mechanism. Should I just keep the lock file then ? |
I think just the lock file makes sense to me. |
getBinary()
multiple times + support custom cache
directorygetBinary()
calls
@lino-levan Ok this is finally ready ! |
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.
LGTM. Will merge in the morning.
This improves
getBinary()
so if it's called multiples times for the same browser version, the install process will occur exactly once