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

Retry when safaridriver fails #48791

Merged
merged 2 commits into from
Dec 7, 2023
Merged

Conversation

vashworth
Copy link
Contributor

@vashworth vashworth commented Dec 7, 2023

Starting safaridriver is flakey sometimes on macOS 13. It will occasionally error with "Operation not permitted". As a workaround, if it fails with that message, retry starting safaridriver.

Fixes flutter/flutter#136972.

Example of fix on macOS 13 bot: https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20Engine%20Drone/564967/overview
Note: The test is still failing due to flutter/flutter#136279, but you can see it first has error "Operation not permitted" and retries and connects on second attempt.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Dec 7, 2023
@vashworth vashworth marked this pull request as ready for review December 7, 2023 19:24
Copy link
Contributor

@eyebrowsoffire eyebrowsoffire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for doing this!

/// "Operation not permitted" error, kill the `safaridriver` process and try
/// again with a different port. Wait [_waitBetweenRetryInSeconds] seconds
/// between retries. Try up to [_maxRetryCount] times.
Future<void> _startDriverProcess() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this isn't just the implementation of spawnDriverProcess rather than overriding prepare?

Copy link
Contributor Author

@vashworth vashworth Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, mostly just to mimic the prepare function in webdriver_browser.dart. Like picking the port and starting the stderr/stdout listeners happens in prepare rather than the spawnDriverProcess. I suppose I could have just used the prepare function rather that _startDriverProcess. What would you suggest?

^^ I read the question wrong.

Yes, in webdriver_browser.dart prepare, it sets the _driverProcess to the result of spawnDriverProcess, but we want to call spawnDriverProcess and update _driverProcess multiple times depending on the stderr from _driverProcess. We could move the _startDriverProcess to webdriver_browser.dart's prepare, but I wasn't sure how other implementations of WebDriverBrowserEnvironment are used so I thought it safer to make the logic exclusive to SafariMacOsEnvironment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks for the clarification!

Copy link
Contributor

@eyebrowsoffire eyebrowsoffire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks again!

/// "Operation not permitted" error, kill the `safaridriver` process and try
/// again with a different port. Wait [_waitBetweenRetryInSeconds] seconds
/// between retries. Try up to [_maxRetryCount] times.
Future<void> _startDriverProcess() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks for the clarification!

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 7, 2023
@auto-submit auto-submit bot merged commit b7b03bd into flutter:main Dec 7, 2023
24 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 7, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 7, 2023
…139768)

flutter/engine@82de334...6d9b2fb

2023-12-07 jason-simmons@users.noreply.github.com Revert Dart SDK back to be8a95b6717d (flutter/engine#48799)
2023-12-07 15619084+vashworth@users.noreply.github.com Retry when safaridriver fails (flutter/engine#48791)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from f49ec3e6c1b1 to b541f668f531 (2 revisions) (flutter/engine#48796)
2023-12-07 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Update clang revision from 00396e6a1a0b7 to b3a9e8f7c0afb00." (flutter/engine#48802)
2023-12-07 chinmaygarde@google.com Update clang revision from 00396e6a1a0b7 to b3a9e8f7c0afb00. (flutter/engine#48705)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from c68e050e9198 to f49ec3e6c1b1 (1 revision) (flutter/engine#48790)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from af998f66ae73 to c68e050e9198 (1 revision) (flutter/engine#48788)
2023-12-07 jason-simmons@users.noreply.github.com Reland "Replace use of Fontmgr::RefDefault with explicit creation calls" (flutter/engine#48764)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from 308f3d9bef2c to af998f66ae73 (1 revision) (flutter/engine#48784)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from 2b33ff5642c3 to 308f3d9bef2c (1 revision) (flutter/engine#48777)
2023-12-07 skia-flutter-autoroll@skia.org Roll Dart SDK from 4b22e6430c20 to b6d5e010d2c5 (1 revision) (flutter/engine#48776)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from 0753f680c573 to 2b33ff5642c3 (1 revision) (flutter/engine#48772)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from 0f1822e9137a to 0753f680c573 (1 revision) (flutter/engine#48771)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from dbcf508d1dce to 0f1822e9137a (1 revision) (flutter/engine#48769)
2023-12-07 skia-flutter-autoroll@skia.org Roll Dart SDK from be8a95b6717d to 4b22e6430c20 (1 revision) (flutter/engine#48768)
2023-12-07 skia-flutter-autoroll@skia.org Roll Skia from 8ebf43ba1c09 to dbcf508d1dce (1 revision) (flutter/engine#48766)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
vashworth added a commit to vashworth/engine that referenced this pull request Dec 14, 2023
Starting `safaridriver` is flakey sometimes on macOS 13. It will occasionally error with "Operation not permitted". As a workaround, if it fails with that message, retry starting `safaridriver`.

Fixes flutter/flutter#136972.

Example of fix on macOS 13 bot: https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20Engine%20Drone/564967/overview
Note: The test is still failing due to flutter/flutter#136279, but you can see it first has error "Operation not permitted" and retries and connects on second attempt.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure to connect to webdriver process on macOS 13 in CI
2 participants