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

Promises that are not awaited or .then'd will swallow exceptions. #4808

Open
p6rt opened this issue Dec 2, 2015 · 4 comments
Open

Promises that are not awaited or .then'd will swallow exceptions. #4808

p6rt opened this issue Dec 2, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 2, 2015

Migrated from rt.perl.org#126787 (status was 'open')

Searchable as RT126787$

@p6rt
Copy link
Author

p6rt commented Dec 2, 2015

From @Juerd

  use v6;

  my $foo;

  my $promise = Promise.new;
  $promise.then​: {
  note 41;
  $foo.does-not-exist; # hangs? thread dies? no error message!
  note 42; # never reached!
  };

  $promise.keep; # no difference with break

  sleep 60;

@p6rt
Copy link
Author

p6rt commented Dec 2, 2015

From @timo

Try with this slightly different code to see that it's not about "calling to methods inside promises", just about an exception in a Promise that nobody is interested in (no await, no .then, ...) are silently nommed​:

  use v6;

  my $foo;

  my $promise = Promise.new;

  $promise.keep; # no difference with break

  # note i added an "await" here.
  await $promise.then​: {
  note 41;
  $foo.does-not-exist; # hangs? thread dies? no error message!
  note 42; # never reached!
  };

  sleep 5;

@p6rt
Copy link
Author

p6rt commented Dec 2, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 14, 2016

From @zoffixznet

On Wed, 02 Dec 2015 13​:52​:24 -0800, timo wrote​:

just about an exception in a
Promise that nobody is interested in (no await, no .then, ...) are
silently nommed​:

This version has a `.then` but doesn't explode. Is it meant to then?

  use v6;
  my $foo;
  my $promise = Promise.new;
  $promise.keep; # no difference with break

  # note i added an "await" here.
  $promise.then({
  note 41;
  $foo.does-not-exist; # hangs? thread dies? no error message!
  note 42; # never reached!
  }).then​: { say "hi" };

  sleep 5;

And this one explodes, but there's no location shown for where the error occurs​:

  use v6;
  my $foo;
  my $promise = Promise.new;
  $promise.keep; # no difference with break

  # note i added an "await" here.
  await $promise.then({
  note 41;
  $foo.does-not-exist; # hangs? thread dies? no error message!
  note 42; # never reached!
  });

  sleep 5;

  # zoffix@​VirtualBox​:~/CPANPRC/rakudo$ ./perl6 test.p6 41
  # ===SORRY!===
  # No such method 'does-not-exist' for invocant of type 'Any'
  # zoffix@​VirtualBox​:~/CPANPRC/rakudo$

This is Rakudo version 2016.11-220-g29b228c built on MoarVM version 2016.11-41-gd2139b5

@p6rt p6rt added the conc label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant