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

Failed to deserialize the passed arguments to the new isolate. (LinkedHashMap) #51226

Closed
Cat-sushi opened this issue Feb 2, 2023 · 1 comment
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@Cat-sushi
Copy link

Cat-sushi commented Feb 2, 2023

This is separated from #50082.
See Dart-Code/Dart-Code#4371, as well.

Dart SDK version: 3.0.0-179.0.dev (dev) (Unknown timestamp) on "linux_x64"

Connecting to VM Service at http://127.0.0.1:33823/qkrWrcyjLfs=/
IDb.read : 3781
Db.fromIDb : 373
Unhandled exception:
IsolateSpawnException: Unable to spawn isolate: Failed to deserialize the passed arguments to the new isolate.
Exited (255)
_AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51)
_AssertionError._throwNew (dart:core-patch/errors_patch.dart:40)
_LinkedHashMapMixin._regenerateIndex (dart:collection-patch/compact_hash.dart:449)
_rehashObjects (dart:collection-patch/compact_hash.dart:21)

VS Code User Settings JSON:

// Disable new SDK DAPs - https://github.com/Dart-Code/Dart-Code/issues/4368
"dart.previewSdkDaps": false,

The application is here
https://github.com/Cat-sushi/fmatch

Don't mind the AGPLv3 license.
You can use the code freely for reproduction of this issue.
This message is the second license.

wserver.dart is the entry point.
The number of isolate of Client.serverMain is depend on the number of cpu cores.
If you want fixed number of isolates, run dart bin/wserver.dart -s4, for example.

@Cat-sushi Cat-sushi changed the title Failed to deserialize the passed arguments to the new isolate. Failed to deserialize the passed arguments to the new isolate. (LinkedHashMap) Feb 2, 2023
@mkustermann
Copy link
Member

Small reproduction is

import 'dart:isolate';

main() async {
  final map = <dynamic>{};
  for (int i = 0; i < 1024 * 1024; ++i) {
    map.add(i);
  }
  map.add(Object()); // will cause requirement for re-hash

  final rp = ReceivePort();
  final sp = rp.sendPort;
  sp.send(map);
  print(await rp.first);
}

launched via

% dart --enable-asserts test.dart 

This happens when the fast object copy allocated the UntaggedMap, invoked CopyMap that initialized it, which adds it to the array of objects to rehash. It then forwards the data_ array (backing store of map) which is too large and bails to slow version of object copy.

The slow version will re-do the CopyMap and re-add it to the set of objects to hash.

That means we have it twice in the array, which causes us to hit the assertion in --enable-asserts mode.

@mkustermann mkustermann self-assigned this Feb 3, 2023
@devoncarew devoncarew added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

3 participants