Skip to content

Message about illegal objects being sent to isolate should refer to local variable names #52957

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

Closed
aam opened this issue Jul 17, 2023 · 0 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-isolate P2 A bug or feature request we're likely to work on

Comments

@aam
Copy link
Contributor

aam commented Jul 17, 2023

As a follow-up to #51115 and in hopes to ease the pain of #36983 (#36983 (comment)) the message should refer to local variables that are on the path to captured context.

So the example generated exception should reference variable x:

$ cat s.dart
import 'dart:isolate';

foo() {
  final x = RawReceivePort();
  RawReceivePort().sendPort.send(() => print("$x"));
}

main() {
   foo();
}
$ out/ReleaseX64/dart s.dart
Unhandled exception:
Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)
 <- Context num_variables: 1
 <- Closure: () => void (from dart:core)

#0      _SendPort._sendInternal (dart:isolate-patch/isolate_patch.dart:244:43)
#1      _SendPort.send (dart:isolate-patch/isolate_patch.dart:225:5)
#2      foo (file:///usr/local/google/home/aam/p/d/dart-sdk/sdk/s.dart:5:29)
#3      main (file:///usr/local/google/home/aam/p/d/dart-sdk/sdk/s.dart:9:4)
#4      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:291:19)
#5      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
@aam aam added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-isolate labels Jul 17, 2023
@a-siva a-siva added the P2 A bug or feature request we're likely to work on label Jul 17, 2023
copybara-service bot pushed a commit that referenced this issue Jul 19, 2023
…g path message.

Retrieval of local names only works in JIT as it relies on availability of LocalVarDescriptors.

For example, for this
```
import 'dart:isolate';

foo() {
  final x = RawReceivePort();
  RawReceivePort().sendPort.send(() => print("$x"));
}

main() {
   foo();
}
```

error message says
```
Unhandled exception:
Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)
 <- field x in foo.<anonymous closure> (from file:///usr/local/google/home/aam/p/d/dart-sdk1/sdk/s1.dart)
```

Bug: #52957
TEST=ci
Change-Id: I684014fd19ea82829e7df17a8a67d386551a5a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314501
Reviewed-by: Ryan Macnak <[email protected]>
Commit-Queue: Alexander Aprelev <[email protected]>
@aam aam closed this as completed Jul 20, 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. library-isolate P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

2 participants