Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

What could cause a Mojolicious::Lite app started with morbo to continuously reload for no apparent reason, as if it was receiving requests, until it gets an actual request? For example, these 9 lines repeat over and over until the app is loaded in a browser, then it stops spewing these lines and works as expected:
Web application available at http://127.0.0.1:3000 GET "/" Routing to a callback 200 OK (0.204005s, 4.902/s) GET "/%3C!DOCTYPE%20html%3E%3Chead%3E ... Template "not_found.development.html.ep" not found Template "not_found.html.ep" not found Rendering template "mojo/debug.html.ep" Your secret passphrase needs to be changed (see FAQ for more) 404 Not Found (0.017273s, 57.894/s)
That 4th line is somehow appending a string of html, which the app builds up and renders, to a get request. I have no idea how that's happening at all, let alone autonomously without loading it in a browser. This is an old working app with no known problems. After restarting morbo a few times all is well, and I can't reproduce it, but am curious if this is a known issue when someone like me does something stupid with the code? Thanks

Tonight at 11...DOOOOOOOOOOOOOOOM!

Replies are listed 'Best First'.
Re: mojo app causes weird morbo loop that stops when app is loaded
by Corion (Patriarch) on May 21, 2024 at 07:39 UTC

    Without seeing relevant code of the app, I would suspect a browser plugin or something like that.

    To better diagnose the source of these bogus requests, consider launching the app on a port that your browser(s) have not seen yet. If the requests still appear, then it is your app itself that issues that request (or some misconfigured other software maybe, trying a health check). I would then dump the IP address of the incoming request.

    I would also look through the code for calls to the application, either through Mojo::UserAgent or app->....

Re: mojo app causes weird morbo loop that stops when app is loaded
by bliako (Abbot) on May 21, 2024 at 06:40 UTC
    GET "/%3C!DOCTYPE%20html%3E%3Chead%3E ...

    from the above it looks like your app is GETting the contents of an HTML file: <!DOCTYPE html><head> ...

    ps. sorry i now saw that you mentioned this in your post

        GET "/%3C!DOCTYPE%20html%3E%3Chead%3E ...

        from the above it looks like your app is GETting the contents of an HTML file: <!DOCTYPE html><head> ...

      It's crazy right? I thought that might be a clue, but I don't have one yet. The second automatic get request is somehow asking for the contents of a string $html which the program builds as it runs and finally renders with $r->render(text=>$html).