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

copypixelbuffer causes crash #10326

Merged
merged 3 commits into from
Oct 4, 2019
Merged

copypixelbuffer causes crash #10326

merged 3 commits into from
Oct 4, 2019

Conversation

WATER1350
Copy link
Contributor

@WATER1350 WATER1350 commented Aug 1, 2019

UnregisterTexture and copypixelbuffer are called on different thread. It may cause crash when user call unregisterTexture and release registered object which implements FlutterTexture protocol on GPU thread while main thread is executing method copypixelbuffer. It would be better to call these functions on a same thread.

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

This patch is not thread safe and I don't think we should land this. Admittedly, the FlutterTexture protocol is not documented and it is not apparent to the caller that the pixel buffer will be copied on an engine managed thread. Instead of changing the behavior now (and affecting all plugin code already written), it would be better to better document the same.

}
});
if (rasterizer_) {
if (auto* registry = rasterizer_->GetTextureRegistry()) {
Copy link
Member

Choose a reason for hiding this comment

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

The rasterizer and the texture registry is only safe to access on the GPU task runner. This call happens on the platform task runner. This is not thread safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, the patch is not thread safe. There is another solution, we can avoiding the object implementing FlutterTexture protocol to be released too early by simply retaining it in engine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chinmaygarde I have made changes.

@cbracken cbracken merged commit 61f058d into flutter:master Oct 4, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 8, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Oct 8, 2019
git@github.com:flutter/engine.git/compare/1d62160fdb2f...4a849e0

git log 1d62160..4a849e0 --no-merges --oneline
2019-10-08 dnfield@google.com Color matrix doc (flutter/engine#12982)
2019-10-07 jason-simmons@users.noreply.github.com Use the standard gen_snapshot target unless the platform requires host_targeting_host (flutter/engine#12988)
2019-10-07 bkonyi@google.com Roll src/third_party/dart 8413a0db0d..8ba6f7e2eb (39 commits) (flutter/engine#12981)
2019-10-07 liyuqian@google.com Unblock Fuchsia roll (flutter/engine#12977)
2019-10-06 chinmaygarde@google.com Update buildroot to pull in ubsan updates. (flutter/engine#12821)
2019-10-05 skia-flutter-autoroll@skia.org Roll src/third_party/skia 95edac1c9a4a..4c82a9fc83a5 (13 commits) (flutter/engine#12818)
2019-10-05 chinmaygarde@google.com Enable sanitizer build variants. (flutter/engine#12816)
2019-10-05 katelovett@google.com Revert "Adding Link SemanticsFlag (#12453)" (flutter/engine#12815)
2019-10-04 jason-simmons@users.noreply.github.com Use the x64 host toolchain for x86 target gen_snapshot only on Linux (flutter/engine#12809)
2019-10-04 yjbanov@google.com add option for bulk-updating screenshots; update screenshots (flutter/engine#12797)
2019-10-04 dnfield@google.com unbreak unopt fuchsia (flutter/engine#12805)
2019-10-04 jason-simmons@users.noreply.github.com Build gen_snapshot with a 64-bit host toolchain even if the target platform is 32-bit (flutter/engine#12802)
2019-10-04 dnfield@google.com [flutter_runner] a11y updates, tests! (flutter/engine#12380)
2019-10-04 WATER1350@gmail.com Fix crash in copypixelbuffer (flutter/engine#10326)
2019-10-04 bkonyi@google.com Roll src/third_party/dart d6c6d12ebf..8413a0db0d (2 commits)
2019-10-04 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from JyZWz... to kwa2O... (flutter/engine#12803)
2019-10-04 katelovett@google.com Adding Link SemanticsFlag (flutter/engine#12453)


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 liyuqian@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
git@github.com:flutter/engine.git/compare/1d62160fdb2f...4a849e0

git log 1d62160..4a849e0 --no-merges --oneline
2019-10-08 dnfield@google.com Color matrix doc (flutter/engine#12982)
2019-10-07 jason-simmons@users.noreply.github.com Use the standard gen_snapshot target unless the platform requires host_targeting_host (flutter/engine#12988)
2019-10-07 bkonyi@google.com Roll src/third_party/dart 8413a0db0d..8ba6f7e2eb (39 commits) (flutter/engine#12981)
2019-10-07 liyuqian@google.com Unblock Fuchsia roll (flutter/engine#12977)
2019-10-06 chinmaygarde@google.com Update buildroot to pull in ubsan updates. (flutter/engine#12821)
2019-10-05 skia-flutter-autoroll@skia.org Roll src/third_party/skia 95edac1c9a4a..4c82a9fc83a5 (13 commits) (flutter/engine#12818)
2019-10-05 chinmaygarde@google.com Enable sanitizer build variants. (flutter/engine#12816)
2019-10-05 katelovett@google.com Revert "Adding Link SemanticsFlag (flutter#12453)" (flutter/engine#12815)
2019-10-04 jason-simmons@users.noreply.github.com Use the x64 host toolchain for x86 target gen_snapshot only on Linux (flutter/engine#12809)
2019-10-04 yjbanov@google.com add option for bulk-updating screenshots; update screenshots (flutter/engine#12797)
2019-10-04 dnfield@google.com unbreak unopt fuchsia (flutter/engine#12805)
2019-10-04 jason-simmons@users.noreply.github.com Build gen_snapshot with a 64-bit host toolchain even if the target platform is 32-bit (flutter/engine#12802)
2019-10-04 dnfield@google.com [flutter_runner] a11y updates, tests! (flutter/engine#12380)
2019-10-04 WATER1350@gmail.com Fix crash in copypixelbuffer (flutter/engine#10326)
2019-10-04 bkonyi@google.com Roll src/third_party/dart d6c6d12ebf..8413a0db0d (2 commits)
2019-10-04 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from JyZWz... to kwa2O... (flutter/engine#12803)
2019-10-04 katelovett@google.com Adding Link SemanticsFlag (flutter/engine#12453)


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 liyuqian@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants