Awaiting a future while the event loop is running would recurse
KES777 opened this issue · comments
I have Mojolicoius application and action which run next helper:
When I update my modules, except WWW/Mechanize/Chrome
Comment out loops as follows:
our @loops = (
# ['Mojo/IOLoop.pm' => 'Chrome::DevToolsProtocol::Transport::Mojo' ],
# ['IO/Async.pm' => 'Chrome::DevToolsProtocol::Transport::NetAsync'],
# ['AnyEvent.pm' => 'Chrome::DevToolsProtocol::Transport::AnyEvent'],
['AE.pm' => 'Chrome::DevToolsProtocol::Transport::AnyEvent'],
# native POE support would be nice
# The fallback, will always catch due to loading strict (for now)
['strict.pm' => 'Chrome::DevToolsProtocol::Transport::AnyEvent'],
);
All is fine, but when I install 'Future::Mojo' I get the error:
Awaiting a future while the event loop is running would recurse at /home/kes/work/projects/tucha/monkeyman/local/lib/perl5/WWW/Mechanize/Chrome.pm line 703.
I can not understand why WWW::Mechanize::Chrome is using Mojo when loops are commented out (see above)?
# Mojo/IOLoop.pm' => 'Chrome::DevToolsProtocol::Transport::Mojo
PS. I do not use latest WWW::Mechanize::Chrome because call to:
my $pdf = $c->html2pdf( $html );
cause application to fall into infinite loop =(
I've added the "pdf infinite loop" case into the test suite, and that case passes for me.
I cannot reproduce your original case, but there are parts of WWW::Mechanize::Chrome where the API is synchronous. These parts don't work very well together with additional other things like a webserver. If you can reduce your program to something shorter that reproduces the issue, I can investigate this further.
The main problem that my app explicitly does not require Mojo::IOLoop
. It was installed as third party dependency soft. Also my app does not use Future::Mojo
Thus I forced to change directly WWW/Mechanize/Chrome
as shown above. This is not good thing, so there should some interface which will allow to select required event loop.
UPD Probably W:M:C should check both: Mojo::IOLoop and Future::Mojo before selecting Chrome::DevToolsProtocol::Transport::Mojo
as transport
you can reduce your program
I will try, so do not close ticket please
I can not reproduce the issue on 0.44 version
thank you very much