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

Dart runtime stuck when uncaught error inside function occur #174

Closed
obiwanzenobi opened this issue Jul 16, 2023 · 3 comments
Closed

Dart runtime stuck when uncaught error inside function occur #174

obiwanzenobi opened this issue Jul 16, 2023 · 3 comments
Assignees

Comments

@obiwanzenobi
Copy link

Checked on 2.17 and 2.18, compared with node-18.0

Creating function with code:

Future<void> start(final req, final res) async {
  throw Exception('Not implemented');
}

will prevent dart runtime from sending ANY answer.

For comparison this code on node-18.0 will fail fast with proper (status 500) response:

module.exports = async function (req, res) {
  throw new Error('Not implemented');
};

Expected behavior: dart runtime fails fast if any internal error is thrown

The problem could be here:
https://github.com/open-runtimes/open-runtimes/blob/main/runtimes/dart-2.17/server.dart#L35
because of:

/// The zone will always be an error-zone ([Zone.errorZone]), so returning
/// a future created inside the zone, and waiting for it outside of the zone,
/// will risk the future not being seen to complete.
@lohanidamodar
Copy link
Contributor

@obiwanzenobi It seems you are using one of the older runtimes, we recommend using dart 2.18 which shouldn't have this issue. Also wait for upcoming release, we are working on adding dart 2.19 and dart 3.0 as well.

@JoshiJoshiJoshi
Copy link

Can it be updated to Dart 3.1 as well?

@stnguyen90
Copy link
Contributor

Closing as the new version of open runtimes will return an error:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants