Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Sep 2, 2022

framework pr: flutter/flutter#110882
issue: flutter/flutter#13937

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 Hixie said 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.

@flutter-dashboard flutter-dashboard bot added embedder Related to the embedder API platform-ios platform-web Code specifically for the web engine labels Sep 2, 2022
@gaaclarke gaaclarke force-pushed the isolate-platform-channels-macos branch from 7a5fbc6 to f957658 Compare September 2, 2022 22:01
@gaaclarke gaaclarke changed the title Isolate platform channels for macos Isolate platform channels for desktop Sep 2, 2022
@gaaclarke gaaclarke force-pushed the isolate-platform-channels-macos branch 5 times, most recently from 2981ed5 to 1983ea1 Compare September 7, 2022 16:57
@gaaclarke gaaclarke force-pushed the isolate-platform-channels-macos branch 11 times, most recently from d19ab9e to 41455fd Compare September 13, 2022 22:11
@gaaclarke gaaclarke force-pushed the isolate-platform-channels-macos branch from a89fa2e to 0e8de60 Compare September 14, 2022 22:59
@gaaclarke gaaclarke marked this pull request as ready for review September 15, 2022 20:38
@gaaclarke gaaclarke requested a review from dnfield September 15, 2022 20:38
Comment on lines 1229 to 1239
#if _WIN32
// On Windows capturing a TaskRunner with a TaskRunner will cause an
// uncaught exception in process shutdown because of the deletion order of
// global variables. See also
// https://github.com/flutter/flutter/issues/111575.
// This won't be an issue until Windows supports background platform
// channels. Then this can potentially be addressed by capturing a
// weak_ptr to an object that retains the ui TaskRunner, instead of the
// TaskRunner directly.
FML_DCHECK(false);
#endif
Copy link
Member Author

Choose a reason for hiding this comment

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

Typically I wouldn't do this but this situation is pretty difficult to debug and I lost a couple days on it so I don't want to lose it. I have another hypothetical refactor that would make it cleaner until we implement background platform channels but I'm not sure if I'll get to finish it (#36157).

Comment on lines 1236 to 1237
// weak_ptr to an object that retains the ui TaskRunner, instead of the
// TaskRunner directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

File an issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

(Or link to an existing one for supporting background channels on Windows, with context added there)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Comment on lines 25 to 26
FML_DLOG(WARNING)
<< "Dropping message on channel " << message->channel();
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like something that falls through the channel buffer logic we have. I'm not quite sure I understand the inter-relationship there. Can you explain it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not suggesting we fully address this in this patch, but maybe we need a bug here, or if not some documentaiton/explanation of why this doesn't apply.

This will end up causing confusing/difficult to debug issues for developers who try to use it and find their messages get dropped (and don't get this log because they're using an opt build).

Copy link
Member Author

Choose a reason for hiding this comment

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

The channel buffers are from Host->Flutter direction. This relates to the Flutter->Host direction. The reasons that this else would be executed is that we send a message on the ui thread to an engine that is getting deleted before the message is received on the platform thread. Dropping them is what we've always done, but we've done it silently in the past. I don't think we should drop messages silently, so I have a debug print.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, ok. Consider updating this message to say something like "Message received on channel " << message->channel() << ", but engine is deleted. Dropping message." or something.

Copy link
Member Author

@gaaclarke gaaclarke Sep 20, 2022

Choose a reason for hiding this comment

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

Done. I tried to be a bit more succinct: "Deleted engine dropping message on channel " << message->channel()

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM with nits

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 20, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 20, 2022

auto label is removed for flutter/engine, pr: 35893, due to - The status or check suite Mac iOS Engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 20, 2022
@gaaclarke gaaclarke force-pushed the isolate-platform-channels-macos branch from eb7a607 to fb8888d Compare September 20, 2022 22:07
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 20, 2022
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 20, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 20, 2022

auto label is removed for flutter/engine, pr: 35893, due to - The status or check suite Linux Fuchsia FEMU has failed. Please fix the issues identified (or deflake) before re-applying this label.

@gaaclarke gaaclarke force-pushed the isolate-platform-channels-macos branch from fb8888d to 7ecde3b Compare September 20, 2022 22:56
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 20, 2022
@auto-submit auto-submit bot merged commit 4395fd0 into flutter:main Sep 20, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 21, 2022
Oleh-Sv pushed a commit to Oleh-Sv/engine that referenced this pull request Sep 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App embedder Related to the embedder API platform-android platform-ios platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants