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

Consolidate ascii spinner stop in devtools activation #75679

Merged
merged 1 commit into from Feb 10, 2021

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Feb 9, 2021

status.stop() in catch was throwing because the timer was already stopped and nulled out. Consolidate the status stop calls into one finally block.

Introduced in #73366
Fixes #75677

@jmagman jmagman self-assigned this Feb 9, 2021
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 9, 2021
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

We really need to make the BufferLogger spinners hit this same assert

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

The devtools launcher is somewhat standalone, could we write a test with this using a fake logger?

@jmagman
Copy link
Member Author

jmagman commented Feb 9, 2021

We really need to make the BufferLogger spinners hit this same assert

That's a good idea.

The devtools launcher is somewhat standalone, could we write a test with this using a fake logger?

There are already tests that exercise the exception case

testWithoutContext('DevtoolsLauncher prints error if exception is thrown during activate', () async {

The status.stop() in the catch throws the The method 'cancel' was called on null seen in the crashes.

if (_devToolsActivateProcess.exitCode != 0) {
status.cancel();
_logger.printError('Error running `pub global activate '
'devtools`:\n${_devToolsActivateProcess.stderr}');
return false;
}
status.stop();
_persistentToolState.lastDevToolsActivationTime = DateTime.now();
return true;
} on Exception catch (e, _) {
status.stop();
_logger.printError('Error running `pub global activate devtools`: $e');
return false;
}

So the original exception caught could be:

  1. pub global activate succeeds, status.stop() is called, then _persistentToolState.lastDevToolsActivationTime = DateTime.now() throws? I don't see how though, the persisting config seems fine.
    set lastDevToolsActivationTime(DateTime time) =>
    _config.setValue(_kLastDevToolsActivationTimeKey, time.toString());
    }

2.pub global activate fails, status.cancel() is called, and _logger.printError('Error running pub global activate devtools:\n${_devToolsActivateProcess.stderr}') throws. I don't see how that could be either.

Let me think about how to test this by simulating either one or two.

@jmagman jmagman merged commit 8f3a624 into flutter:master Feb 10, 2021
@jmagman jmagman deleted the spinner branch February 10, 2021 00:06
christopherfujino pushed a commit to christopherfujino/flutter that referenced this pull request Mar 17, 2021
christopherfujino added a commit that referenced this pull request Mar 19, 2021
* Avoid iOS local networking dialog in integration tests (#75163)

* ios_platform_view tests pass when device rotated (#75665)

* Consolidate ascii spinner stop in devtools activation (#75679)

* Fix problem causing tasks to timeout. (#76028)

This is because the command was actually collecting logs continuously
from the device. Additionally idevicesyslog does not have a reboot
option.

Bug: #76027

* fix Autovalidate enum references in fix data (#77419)

* roll engine cherrypicks

Co-authored-by: Jenn Magder <magder@google.com>
Co-authored-by: godofredoc <54371434+godofredoc@users.noreply.github.com>
Co-authored-by: Phil Quitslund <pq@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NoSuchMethodError: The method 'cancel' was called on null at AnsiSpinner.finish
2 participants