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

Conversation

@chinmaygarde
Copy link
Member

This class is meant to be thread safe. In fact, its headerdoc statement on
thread safety even mentions this. All fields on the class are readonly except
the child isolate preparer. This field is set during VM instantiated isolate
initialization. The VM may launch multiple isolate in the same isolate group on
at the same time (each on a VM backed thread pool thread). Attempting to set the
field without synchronization is a data race.

Fixes flutter/flutter#49358
Fixes b/147798920

This class is meant to be thread safe. In fact, its headerdoc statement on
thread safety even mentions this. All fields on the class are readonly except
the child isolate preparer. This field is set during VM instantiated isolate
initialization. The VM may launch multiple isolate in the same isolate group on
at the same time (each on a VM backed thread pool thread). Attempting to set the
field without synchronization is a data race.

Fixes flutter/flutter#49358
Fixes b/147798920
@chinmaygarde
Copy link
Member Author

chinmaygarde commented Jan 23, 2020

I believe this patch is necessary and sufficient to address the data race. I was having a chat with Jason about his hypothesis. I do not believe that proposal is thread-safe because the two threads could be racing to initialize the preparer and could have performed the get call and then simultaneously try to set the preparer leading to the exact same issue. However, both of us agree that the preparation routine is unnecessarily complicated (with the support for multiple kernel buffer mappings adding the most code complexity) and we are going to simplify the same. We also don't believe that the getter should ever be nullptr. So the entire thing should be simplified. Jason has volunteered to verify our hypothesis using logs while I am trying to preparing ASAN run to reproduce the race in unit-test. I want to put this patch out ASAP in case there are time constraints for having this fixed.

@chinmaygarde
Copy link
Member Author

LUCI is red because of a hot-fix patch. Will disregard that presubmit to get things going.

@chinmaygarde chinmaygarde merged commit f10f03a into flutter:master Jan 24, 2020
@chinmaygarde chinmaygarde deleted the isolate_group_data_race branch January 24, 2020 00:03
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 24, 2020
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Jan 24, 2020
flutter/engine@439a218...f10f03a

git log 439a218..f10f03a --first-parent --oneline
2020-01-24 [email protected] Fix data race in DartIsolateGroupData. (flutter/engine#15949)
2020-01-23 [email protected] [fuchsia] Add LogSink to flutter_[jit & aot]_product_runner (flutter/engine#15697)
2020-01-23 [email protected] Do not produce timeline events in release mode (flutter/engine#15894)
2020-01-23 [email protected] Roll src/third_party/dart e84bea25df23..3eaae5405d37 (17 commits) (flutter/engine#15946)
2020-01-23 [email protected] Roll src/third_party/skia e4ddb8a7cddc..c88a3bc3f561 (24 commits) (flutter/engine#15945)


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 [email protected] 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
NoamDev pushed a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
This class is meant to be thread safe. In fact, its headerdoc statement on
thread safety even mentions this. All fields on the class are readonly except
the child isolate preparer. This field is set during VM instantiated isolate
initialization. The VM may launch multiple isolate in the same isolate group on
at the same time (each on a VM backed thread pool thread). Attempting to set the
field without synchronization is a data race.

Fixes flutter/flutter#49358
Fixes b/147798920
NoamDev added a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[elided] Crash signature "dart::SpawnIsolateTask::Run-5726ab5f" on [elided version]

3 participants