Sdk: Isolate.spawnUri does not support spawning from http urls

Created on 3 Jul 2018  路  5Comments  路  Source: dart-lang/sdk

It appears that with the introduction of the new front-end we no longer support spawning from http URIs:

Launching a server which serves hello.dart:

% echo 'main() => print("hello world");' > hello.dart
% python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

Testing it with:

% cat test.dart
import 'dart:async';
import 'dart:isolate';

main() async {
  await Isolate.spawnUri(Uri.parse('http://localhost:8000/hello.dart'), null, null);
  await new Future.delayed(const Duration(seconds: 10));
}

Running with dev.63

% dart-sdk-63/bin/dart test.dart
hello world

Running with dev.66

% dart-sdk-66/bin/dart test.dart
Unhandled exception:
IsolateSpawnException: Unable to spawn isolate: http://localhost:8000/hello.dart:1: Error: File http://localhost:8000/hello.dart does not exist.
#0      Isolate.spawnUri (dart:isolate/runtime/libisolate_patch.dart:450:14)
<asynchronous suspension>
#1      main (.../test.dart:5:17)
<asynchronous suspension>
#2      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:279:19)
#3      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)

@lrhn I assume this functionality has not been removed intentionally?

@kmillikin / @mraleph Guess the CFE needs to be implemented ?

P1 area-front-end type-bug

All 5 comments

This is blocking upgrading package:rpc (which is a popular package) to Dart 2.0

I'm not aware of any plan to remove the functionality. I'm guessing the front-end just doesn't have a way to load sources from HTTP URIs.

With a little luck, file loading in the front-end can be overridden by the VM, so they can add HTTP loading as well. (Confirmed: The VM needs to provide an implementation of FileSystem which supports HTTP URIs).

Should this be marked as blocking Dart 2 stable release? @mkustermann

Should this be marked as blocking Dart 2 stable release? @mkustermann

Since @lrhn says we should have this functionality working and we own packages which need it (as might other 3rd party packages) to be Dart 2.0 compliant, I would think so.

Duplicate of #33388

Was this page helpful?
0 / 5 - 0 ratings