Open toratora opened 2 years ago
Yes, that has to be a Future::AsyncAwait
bug, since the async/await protocol only uses uppercase methods like AWAIT_ON_CANCEL
.
I think https://rt.cpan.org/Public/Bug/Display.html?id=137723 refers to the same issue.
monkey_patch 'Mojo::Promise', on_cancel => sub {};
seems to resolve the issue.
It's probably this line. https://metacpan.org/release/PEVANS/Future-AsyncAwait-0.55/source/lib/Future/AsyncAwait.xs#L1753
I think that's supposed to be a call to AWAIT_ON_CANCEL
like in MY_future_chain_on_cancel
call_method("AWAIT_ON_CANCEL", G_VOID);
I see on_cancel
in that code but not in the context of being a parameter to call_method
.
Ahyes, requires some API reshaping first in Future itself. This part wasn't quite finished:
https://metacpan.org/pod/Future::AsyncAwait::Awaitable#AWAIT_ON_CANCEL
Issue seems resolved with release of Future::AsyncAwait 0.56
. Thanks for the quick fix @leonerd.
@kraih Might want to update Future::AsyncAwait requirement to 0.56.
>= 9.21
5.20.3
macOS Catalina 10.15.7
andCentOS 7.8
I get this exception when using
async/await
onMojo::UserAgent::get_p
(or anyMojo::Promise
) after upgrading fromMojolicious 9.19 (and Future::AsyncAwait 0.48)
toMojolicious 9.22 (and Future::AsyncAwait 0.55)
. This issue appears on perlv5.20.3
but disappears when I switch tov5.30.0
.I came across this in some code in one of my
Mojolicious
app controller classes but here's a script I used to replicate the problem:cpanfile
:Expected output for this script is:
It works fine on
perl 5.20.3
,<= Mojolicious 9.19
, andFuture::AsyncAwait 0.48
. It also works fine onperl 5.30.0
,Mojolicious >=9.21
, andFuture::AsyncAwait >= 0.52
.However, on
perl 5.20.3
,Mojolicious >=9.21
, andFuture::AsyncAwait >= 0.52
I get the following output with the exceptionCan't locate object method "on_cancel" via package "Mojo::Promise"
:This may ultimately be an issue with
Future::AsyncAwait
but it affectsMojolicious
sinceFuture::AsyncAwait >= 0.52
is required sinceMojolicious 9.21