8000 Do exponential backoff for all exceptions in VMService::defaultOpenChannel. by tvolkert · Pull Request #16785 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Do exponential backoff for all exceptions in VMService::defaultOpenChannel. #16785

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

Merged
merged 3 commits into from
Apr 20, 2018
Merged

Conversation

tvolkert
Copy link
Contributor
@tvolkert tvolkert commented Apr 20, 2018

We were trying to only catch WebSocketException, but in fact
SocketException can be thrown as well.

…annel

We were trying to only catch WebSocketException, but in fact
SocketException can be thrown as well.
@chinmaygarde chinmaygarde changed the title Do exponential backoff for all exceptions in VMService::defaultOpenCh… Do exponential backoff for all exceptions in VMService::defaultOpenChannel. Apr 20, 2018
@yjbanov
Copy link
Contributor
yjbanov commented Apr 20, 2018

lgtm

@yjbanov
Copy link
Contributor
yjbanov commented Apr 20, 2018

Feel free to land as soon as Travis is happy. Should be a matter of updating vmservice_test.dart.

@tvolkert tvolkert merged commit 12bbaba into flutter:master Apr 20, 2018
@tvolkert tvolkert deleted the bots branch April 20, 2018 06:36
@@ -53,7 +53,7 @@ Future<StreamChannel<String>> _defaultOpenChannel(Uri uri) async {
attempts += 1;
try {
socket = await io.WebSocket.connect(uri.toString());
} on io.WebSocketException catch(e) {
} catch (e) {
printTrace('Exception attempting to connect to observatory: $e');
Copy link
Contributor

Choose a reason for hiding this comment

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

This means if the error was something like a CompilerError, we'll retry anyway, which is a bit weird. But I guess we're seeing a lot of different kinds of errors here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can get both SocketException and WebSocketException, which for some reason don't extend one another. So I could have added two catch blocks, but I went with just a global catch. Lemme know if you think I should change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

As a general rule I prefer not doing global catches because they tend to swallow real errors. In this case it's not a huge deal since the real errors will still get noisily printed to the console and eventually result in a failure. I'll leave it up to you which way you want to go on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What we really want here is Java multi-catch ability:

} on io.SocketExceptiojn, io.WebSocketException catch (e) {
  ...
}

But that doesn't exist. Given the limited scope of what's in this try/catch, I'm fine with leaving it as-is, but I don't feel strongly either way.

DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
…annel. (flutter#16785)

We were trying to only catch WebSocketException, but in fact
SocketException can be thrown as well.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0