Skip to content

Dart VM hangs if script use class with parameters in it constructor inside Isolate #3151

Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Paste code below into new dart script - test_isolate.dart:

import("dart:isolate");

class TestClass{
  String strField;
  TestClass(this.strField);
}

Future<String> someFunction(msg) {
  print('someFunction called with param $msg');
  Completer completer = new Completer();
  // Next line caused dart vm hangup.
  TestClass test = new TestClass('asdfadsf');
  
  completer.complete("some dummy data");
  return completer.future;
}

new_isolate() {
  port.receive((msg, reply) {
    Future f = someFunction(msg);
    f.then((r)=>reply.send(r));
  });
}

main() {
  spawnFunction(new_isolate).call("testMessage").then((s)=>print("result = $s"));
}

  1. Invoke dart on script test_isolate.dart

What is the expected output?
>> someFunction called with param testMessage
>> result = some dummy data

What do you see instead?
 -- Dart process hangs up.

Another twist: Script works successfully with line
 -- TestClass test = new TestClass('asdfadsf');
modified to
 -- var test = new TestClass('asdfadsf');

What version of the product are you using? On what operating system?
Dart-sdk revision 7552
Windows 7 32bit.

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.closed-cannot-reproduceClosed as we were unable to reproduce the reported issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions