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

Future returned from Isolate.spawnUri(bad library) does not complete #15348

Closed
DartBot opened this issue Nov 27, 2013 · 6 comments
Closed

Future returned from Isolate.spawnUri(bad library) does not complete #15348

DartBot opened this issue Nov 27, 2013 · 6 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-isolate type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented Nov 27, 2013

This issue was originally filed by alexe.kaigorodov@gmail.com


What steps will reproduce the problem?

  1. Let library "bad_isolate.dart" does not contain main() function.
  2. Future fut = Isolate.spawnUri(new Uri.file("bad_isolate.dart"), [], null);
  3. fut.whenComplete(()=>print ("Completed!"));

What is the expected output?
Callback set by Future.whenComplete(), or Future.then(), should be invoked.

What do you see instead?
The main program hangs.

What version of the product are you using? On what operating system?
Dart VM version: 1.0.0.3_r30188 (Tue Nov 12 01:15:26 2013) on "linux_ia32"

Please provide any additional information below.

@iposva-google
Copy link
Contributor

Added Area-Library, Library-Isolate, Triaged labels.

@floitschG
Copy link
Contributor

Changed the title to: "Future returned from Isolate.spawnUri(bad library) does not complete".

@floitschG
Copy link
Contributor

Reassigning to VM.

When running the given example I see the following output:
===
$ out/ReleaseIA32/dart /tmp/bug.dart
in ShutdownIsolate: Unable to resolve function 'main' in library 'file:///tmp/bad.dart'.
===

The error comes from isolate.cc:595 ShutdownIsolate, and it doesn't look like the Dart side gets to see the error.

I'm willing to dig deeper, but I would prefer if the VM devs have a look first.


cc @a-siva.
cc @iposva-google.
Removed Area-Library label.
Added Area-VM label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-isolate labels Nov 27, 2013
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
@alsemenov
Copy link
Contributor

The problem is still reproducible at least on Dart VM version: 1.17.1 (Fri Jun 10 04:58:25 2016) on "windows_x64". I think it is important to fix this, because it will make Dart more programmer-friendly.

@alsemenov
Copy link
Contributor

The problem is still reproducible at least on Dart VM version: 1.20.1 (Wed Oct 12 15:07:45 2016) on "windows_x64"

@mkustermann
Copy link
Member

@alsemenov Apologies that nobody looked at this issue for so long.

I have just tried to reproduce the issue and it seems that one does get a meaningful error message one can act upon:

import 'dart:io';
import 'dart:isolate';

main() async {
  // Notice that "bar.dart" doesn't contain a "main" function.
  File('bad.dart').writeAsStringSync('foo() {}');

  try {
    await Isolate.spawnUri(Uri.parse('bad.dart'), [], null);
  } catch (e) {
    print('Got error: $e');
  }
}

This will print an error and exit the program (i.e. not hang):

% dart test.dart
Got error: IsolateSpawnException: Unable to spawn isolate: Dart_LoadScriptFromKernel: The binary program does not contain 'main'.
% 

This issue seems to be fixed.

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, FFI, and the AOT and JIT backends. library-isolate type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

6 participants