Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
/enginePublic archive

[fuchsia] Pass WeakPtrs to GfxConnection FIDL fns.#28951

Merged
fluttergithubbot merged 3 commits intoflutter:masterfrom
akbiggs:session-restart-2
Oct 1, 2021
Merged

[fuchsia] Pass WeakPtrs to GfxConnection FIDL fns.#28951
fluttergithubbot merged 3 commits intoflutter:masterfrom
akbiggs:session-restart-2

Conversation

@akbiggs
Copy link
Contributor

@akbiggsakbiggs commentedSep 30, 2021
edited
Loading

Bug: fxb/85211
Tested: Ran Spinning Square with flutter_jit_runner.

Crash occurs inGfxSessionConnection::FireCallbackMaybe on session restart. This implies that the crash might be happening as a result of state that has been destroyed when the callback fires. We pass a WeakPtr to the current GfxSessionConnection into FIDL callbacks to check that we haven't already been destroyed when the FIDL callback fires.

I haven't been able to reproduce the crash locally so I'm not 100% sure if this fixes the issue or not, but it seems like it will make the code safer.

@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 inChat.

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 theTree Hygiene page and make sure this patch meets those guidelines before LGTMing.

FireCallbackMaybe();
//
// Inspect updates must run on the inspect dispatcher. We don't pass
// |weak| to the callback because there is no guarantee that the
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'm not sure if this statement that "there is no guarantee that callbacks [invoked by inspect_dispatcher_] will run on the same thread" is true or not. However, because I'm not certain, it feels safer to avoid passing the WeakPtr into here.

Copy link
Contributor

@arbrengarbrengSep 30, 2021
edited
Loading

Choose a reason for hiding this comment

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

Upon closer inspection of the code, that statement is not true n this case. But it's all super implicit (sorry about that) so it requires scanning the entire class to know that....

  1. inspect_dispatcher_ == async_get_default_dispatcher() from the thread the GfxConnection ctor ran on (this is in the constructor).
  2. session_wrapper's dispatcher also == async_get_default_dispatcher() from the thread the GfxConnection ctor ran on (the fidl InterfaceHandle was bound to this thread in the constructor).
  3. Thus, the body of the session_wrapper_.set_on_frame_presented_handler callback runs on the same dispatcher as inspect_dispatcher_. All of this code is running on the same thread. It's safe to just use the weak_ptr everywhere (and that is by design, we never intend the callback and inspect to operate on multiple threads).

Again, super non-obvious without a deep understanding of this class. Suggestions on how to make that more clear very welcome.

Copy link
Contributor

Choose a reason for hiding this comment

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

Further explanation: the only part of this class that runs on another thread is the "AwaitVsync" method. The flutter engine calls back into that method on the "UI" thread. All of the other operations in this class are taking place on the "Raster" thread.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

No worries and thanks for the detailed explanation - super useful to know what threads different parts of this code are running on. I had a hard time finding the header for async_get_default_dispatcher, but now that I've found it, it's super clear. Changed the code to avoid the nastythiz = this nonsense.

@chinmaygarde
Copy link
Contributor

Just a heads up, fml::WeakPtrs can only be "used" (copying around is fine) on the threads on which they were were created. If is hard for me to tell if this condition is being violated here. Probably not, but just a heads up.

@akbiggs
Copy link
ContributorAuthor

@chinmaygarde Thanks for the heads-up. I had read through the documentation and looked through the callbacks to verify that they are all being run on the same thread in this case.

@google-cla
Copy link

All (the pull request submitter and all commit authors) CLAs are signed,but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only@googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set thecla label toyes (if enabled on your project).

ℹ️Googlers:Go here for more info.

@google-clagoogle-clabot added cla: no and removed cla: yes labelsOct 1, 2021
@akbiggs
Copy link
ContributorAuthor

Ugh I blew up my pull request again. One sec, not going to submit it.

@google-clagoogle-clabot added cla: yes and removed cla: no labelsOct 1, 2021
@akbiggsakbiggs added the waiting for tree to go greenThis PR is approved and tested, but waiting for the tree to be green to land. labelOct 1, 2021
@fluttergithubbotfluttergithubbot merged commit8ec71b6 intoflutter:masterOct 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull requestOct 1, 2021
dnfield pushed a commit to dnfield/engine that referenced this pull requestOct 6, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@chaselattachaselattaAwaiting requested review from chaselatta

1 more reviewer

@arbrengarbrengarbreng approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

cla: yesneeds testsplatform-fuchsiawaiting for tree to go greenThis PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@akbiggs@chinmaygarde@arbreng@fluttergithubbot

Comments


[8]ページ先頭

©2009-2026 Movatter.jp