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

Awaiting a future while the event loop is running would recurse #46

Closed
KES777 opened this issue Nov 29, 2019 · 4 comments
Closed

Awaiting a future while the event loop is running would recurse #46

KES777 opened this issue Nov 29, 2019 · 4 comments

Comments

@KES777
Copy link

KES777 commented Nov 29, 2019

I have Mojolicoius application and action which run next helper:

Chrome.pm.txt

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 =(

Corion pushed a commit that referenced this issue Jan 3, 2020
This is one part of that issue, and likely the minor part
@Corion
Copy link
Owner

Corion commented Jan 3, 2020

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.

@KES777
Copy link
Author

KES777 commented Jan 8, 2020

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

@KES777
Copy link
Author

KES777 commented Jan 8, 2020

you can reduce your program

I will try, so do not close ticket please

@KES777
Copy link
Author

KES777 commented Jan 8, 2020

I can not reproduce the issue on 0.44 version

thank you very much

@KES777 KES777 closed this as completed Jan 8, 2020
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

2 participants