-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Taking snapshot fails with RangeError: Offset (1163457) must be a multiple of BYTES_PER_ELEMENT
#55475
Comments
Repro:
![]()
|
I'm not able to reproduce on Flutter master and the latest DevTools:
I have a x64 Mac, so maybe that has something to do with it. @derekxu16, can you give this a try? |
The error should not depend on the CPU alignment, it's an intrinsic requirement of the typed-data classes that they start at the correct place in a buffer. The current version of The line if (_currentChunkHasBytes(len * 2) && _byteIndex & 1 == 0) { should be if (_currentChunkHasBytes(len * 2) && (_currentChunk.offsetInBytes + _byteIndex) & 1 == 0) { @osa1 Seems to be your code from https://dart-review.googlesource.com/c/sdk/+/340182 |
RangeError: Offset (1163457) must be a multiple of BYTES_PER_ELEMENT
RangeError: Offset (1163457) must be a multiple of BYTES_PER_ELEMENT
Thank you! If it helps, this is exact project for repro: https://github.com/polina-c/spikes/tree/master/counter It is a modified counter. On each click it aggressively allocates memory into array, and there is additional button to clear the array. |
I was trying to reproduce the problem first to check if the patch fixes the issue, but I'm also unable to reproduce it. I'm making a CL with the patch now. |
Thank you @derekxu16! |
Issue: #55475 Change-Id: Ib7b09e21096dd76cee5037c3120a7944a2b85340 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363120 Reviewed-by: Ben Konyi <bkonyi@google.com> Commit-Queue: Derek Xu <derekx@google.com>
Looks like the change made it to the beta branch and so will end up in stable, @derekxu16 we will probably need a cherry pick of your change |
Linking fix here: https://dart-review.googlesource.com/c/sdk/+/363120 |
The failing snapshot, after |
14.2.1 of vm_service contains the fix @kenzieschmoll , do we need to cherry pick the upgrade to make sure DevTools with the issue does not squeeze into Flutter master? |
Upgrade for DevTools: flutter/devtools#7597 |
What version of Flutter did this first start on? If this breakage is on the beta channel, then we need to cherry-pick the fix to beta. If the breakage is only on master, then no need for a cherry pick. |
It is introduced by this PR: https://dart-review.googlesource.com/c/sdk/+/340182 |
Contributes to dart-lang/sdk#55475
If DevTools fails on beta even with @derekxu16's cherry pick, then yes we will need a DevTools cherry pick (2.34.3) into the Dart SDK as well, and then into Flutter. @polina-c or @derekxu16 can you drive this? |
The fix is |
Oh, I see flutter/flutter#125231. So when |
TEST=confirmed that the added test case fails when undoing the changes made in package:vm_service 14.2.1 Issue: #55475 Change-Id: I189db9dda4c730199157432522323e34a6f87c9c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363441 Commit-Queue: Derek Xu <derekx@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com>
CP request: #146897 Upstream bug: dart-lang/sdk#55475
@derekxu16 have you verified that DevTools is WAI with your flutter cherry pick included? The change @polina-c made to bump the DevTools dependency on vm_service to 14.2.1 is not included in the Dart or Flutter SDKs, and won't be in the build your cherry-pick makes it into. |
What should happen first: cherry pick of fixed DevTools into Dart SDK or cherry pick of fixed vm_service into Dart SDK? Or it does not matter? |
Since there's a prebuilt copy of DevTools in the Dart SDK, you're right that a new build of DevTools built with |
We want to build fix for DevTools with already cherry picked SDK. So we need cherry pick of vm_service to land first. |
DevTools needs to be built against a version of the Flutter SDK that accepts |
started putting together DevTools cherry pick. |
I'm a little confused as to what needed to match here, and it sounds like we're now doing the right thing. However, once we get all the right CPs in, this feels like a tricky situation we could very well mess up next time. Is the issue that flutter_tools and dev_tools need to have matching vm_service versions? Or just we want to ensure that none of the tools we're shipping in the Flutter SDK have the affected (14.2.0) vm_service version? If it's the former, we could add a flutter/flutter test to verify this. If it's the latter, I've been playing around with a tool to make inspecting the transitive deps of a Flutter SDK more easily inspectable, that would probably help in situations like this. |
I think we just want every tool not to have 14.2.0. |
The prebuilt version of DevTools in the current Dart SDK beta candidate was built with |
Easy way to understand what is built with what would be very helpful! |
Okay, I did
This means I want to cherry pick DevTools with tag Sounds correct? |
Contributes to dart-lang/sdk#55475
Has anyone manually reproduced the failure with DevTools from a Flutter beta branch with Derek's fix included (@polina-c or @derekxu16)? If the bug was caused because of the VM service logic that is running on the device, then it is possible that cherry-picking Derek's change into Flutter is enough. Based on flutter/devtools#7597, it doesn't look like there are any logic changes in DevTools that came with the vm_service version bump, which would make me think that it's possible no cherry-pick is needed for DevTools. Someone should confirm manually that the issue still exists before we move forward with a DevTools cherry-pick. |
Are you saying DevTools will pickup 14.2.1 from sdk, even if it was built with 14.2.0? The issue is flaky, so even if it does not repro, it does not mean it is fixed. How does it sound? |
I'm saying that if the crash happened because of the VM service running on the device, then it is possible that Derek's fix may be compatible with the existing DevTools on beta, and there would be no need to rebuild DevTools with 14.2.1. If 14.2.1 has implications that would change DevTools logic, then we'd need to CP DevTools too, but looking at your DevTools PR, it was just a patch version changes with no other changes. Which makes me think that the existing DevTools on beta may be compatible with the vm_service changes that Derek CP'ed into Flutter. |
The error did not happen because of the VM Service running on the device, it happened when DevTools called |
Yes, the fix is not in vm itself, it is in the code of vm_service: https://dart-review.googlesource.com/c/sdk/+/363120 |
Cherry pick is waiting for @kenzieschmoll to decide if we are doing it: https://dart-review.googlesource.com/c/sdk/+/363642 |
Contributes to dart-lang/sdk#55475
Contributes to dart-lang/sdk#55475
Contributes to dart-lang/sdk#55475
The [Cherry-pick] link below is fake. There is no real link yet, because DevTools with fix will release to main at normal schedule. Bug: #55475 Cherry-pick: flutter/devtools#7597, flutter/devtools#7633 Cherry-pick-request: #55509 Change-Id: I6f9a90f49d4efb3c65147f9132866c7c5432410a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363642 Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com> Reviewed-by: Elliott Brooks <elliottbrooks@google.com> Reviewed-by: Jacob Richman <jacobr@google.com>
Cherry pick is merged. Thanks all for help and catches. It was a significant and risky effort to sync the fix between 4 products (vm_service, DevTools, DartSDK, Flutter). IMHO it would be great to prioritize test coverage for the fix, to avoid repeating this. |
I believe Derek has added a test for this at |
Tried for macos and for android emulator. I have mac arm64.
The text was updated successfully, but these errors were encountered: