I'm having trouble with all the different ways of setting inactivity_timeout.
http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean says: > It defaults to 20 seconds for the user agent and 15 seconds for all > built-in web servers, and can be changed with the attributes > "inactivity_timeout" > in Mojo::UserAgent > <http://mojolicious.org/perldoc/Mojo/UserAgent#inactivity_timeout> and > "inactivity_timeout" > in Mojo::Server::Daemon > <http://mojolicious.org/perldoc/Mojo/Server/Daemon#inactivity_timeout> or > the MOJO_INACTIVITY_TIMEOUT environment variable. In Mojolicious > <http://mojolicious.org/perldoc/Mojolicious> applications you can also > use the helper "inactivity_timeout" in Mojolicious::Plugin::DefaultHelpers > <http://mojolicious.org/perldoc/Mojolicious/Plugin/DefaultHelpers#inactivity_timeout> > to change it on demand for each connection individually. This timeout > always applies, so you might have to tweak it for applications that take a > long time to process a request. > Most confusing is that morbo declares an inactivity timeout *sometimes* if I both set MOJO_INACTIVITY_TIMEOUT=2 and set $c->inactivity_timeout(2) via the helper and then sleep 3. (see morboruns.txt) Here is the tiny app I'm testing with: #!/usr/bin/perl -w use Mojolicious::Lite; use 5.20.0; use experimental 'signatures'; get '/' => sub { my ($c) = @_; if (defined $ENV{MY_INACTIVITY}) { $c->app->log->debug( sprintf "setting \$c->inactivity_timeout(%d)", $ENV{MY_INACTIVITY} ); $c->inactivity_timeout($ENV{MY_INACTIVITY}); } my $sleep = $ENV{SLEEP} // 20; $c->app->log->debug( sprintf "sleeping %d", $sleep ); sleep $sleep; $c->render(text => "hello world") }; app->start; I get similar inconsistencies when running both: SLEEP=3 MY_INACTIVITY=2 MOJO_INACTIVITY_TIMEOUT=2 morbo lite.pl and SLEEP=3 MY_INACTIVITY=2 MOJO_INACTIVITY_TIMEOUT=2 ./lite.pl daemon -m production -l http://*:8081 Is there anything I'm doing wrong? I was expecting it to always declare an inactivity timeout given these settings. Sincerely, Peter -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
In two terminals: * First terminal runs the morbo webserver with a timeout of 2 and a sleep of 3. I would expect it declare intactivity every time! * Second terminal runs wget --tries=5 ################################################################################ # First terminal ################################################################################ londo@peter:~/git/capmon/mojo> SLEEP=3 MY_INACTIVITY=2 MOJO_INACTIVITY_TIMEOUT=2 morbo lite.pl Server available at http://127.0.0.1:3000 [Mon Jan 16 17:29:51 2017] [debug] GET "/" [Mon Jan 16 17:29:51 2017] [debug] Routing to a callback [Mon Jan 16 17:29:51 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:29:51 2017] [debug] sleeping 3 [Mon Jan 16 17:29:54 2017] [debug] 200 OK (3.001306s, 0.333/s) [Mon Jan 16 17:29:54 2017] [debug] Inactivity timeout [Mon Jan 16 17:29:55 2017] [debug] GET "/" [Mon Jan 16 17:29:55 2017] [debug] Routing to a callback [Mon Jan 16 17:29:55 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:29:55 2017] [debug] sleeping 3 [Mon Jan 16 17:29:58 2017] [debug] 200 OK (3.000581s, 0.333/s) [Mon Jan 16 17:30:03 2017] [debug] GET "/" [Mon Jan 16 17:30:03 2017] [debug] Routing to a callback [Mon Jan 16 17:30:03 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:30:03 2017] [debug] sleeping 3 [Mon Jan 16 17:30:06 2017] [debug] 200 OK (3.000774s, 0.333/s) [Mon Jan 16 17:30:09 2017] [debug] GET "/" [Mon Jan 16 17:30:09 2017] [debug] Routing to a callback [Mon Jan 16 17:30:09 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:30:09 2017] [debug] sleeping 3 [Mon Jan 16 17:30:12 2017] [debug] 200 OK (3.000549s, 0.333/s) [Mon Jan 16 17:30:12 2017] [debug] Inactivity timeout [Mon Jan 16 17:30:13 2017] [debug] GET "/" [Mon Jan 16 17:30:13 2017] [debug] Routing to a callback [Mon Jan 16 17:30:13 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:30:13 2017] [debug] sleeping 3 [Mon Jan 16 17:30:16 2017] [debug] 200 OK (3.000612s, 0.333/s) [Mon Jan 16 17:30:16 2017] [debug] Inactivity timeout [Mon Jan 16 17:30:18 2017] [debug] GET "/" [Mon Jan 16 17:30:18 2017] [debug] Routing to a callback [Mon Jan 16 17:30:18 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:30:18 2017] [debug] sleeping 3 [Mon Jan 16 17:30:21 2017] [debug] 200 OK (3.000569s, 0.333/s) [Mon Jan 16 17:30:21 2017] [debug] Inactivity timeout [Mon Jan 16 17:30:24 2017] [debug] GET "/" [Mon Jan 16 17:30:24 2017] [debug] Routing to a callback [Mon Jan 16 17:30:24 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:30:24 2017] [debug] sleeping 3 [Mon Jan 16 17:30:27 2017] [debug] 200 OK (3.000596s, 0.333/s) [Mon Jan 16 17:30:27 2017] [debug] Inactivity timeout [Mon Jan 16 17:30:31 2017] [debug] GET "/" [Mon Jan 16 17:30:31 2017] [debug] Routing to a callback [Mon Jan 16 17:30:31 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:30:31 2017] [debug] sleeping 3 [Mon Jan 16 17:30:34 2017] [debug] 200 OK (3.000675s, 0.333/s) [Mon Jan 16 17:30:34 2017] [debug] Inactivity timeout [Mon Jan 16 17:30:37 2017] [debug] GET "/" [Mon Jan 16 17:30:37 2017] [debug] Routing to a callback [Mon Jan 16 17:30:37 2017] [debug] setting $c->inactivity_timeout(2) [Mon Jan 16 17:30:37 2017] [debug] sleeping 3 [Mon Jan 16 17:30:40 2017] [debug] 200 OK (3.000951s, 0.333/s) ################################################################################ # Second terminal ################################################################################ londo@peter:~/git/capmon/mojo> time wget -O /dev/null --tries=2 http://localhost:3000/ --2017-01-16 17:29:21-- http://localhost:3000/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... No data received. Retrying. --2017-01-16 17:29:25-- (try: 2) http://localhost:3000/ Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... 200 OK Length: 11 [text/html] Saving to: ‘/dev/null’ /dev/null 100%[=====================>] 11 --.-KB/s in 0s 2017-01-16 17:29:28 (2.90 MB/s) - ‘/dev/null’ saved [11/11] real 0m7.013s user 0m0.000s sys 0m0.004s londo@peter:~/git/capmon/mojo> time wget -O /dev/null --tries=5 http://localhost:3000/ --2017-01-16 17:29:51-- http://localhost:3000/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... No data received. Retrying. --2017-01-16 17:29:55-- (try: 2) http://localhost:3000/ Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... 200 OK Length: 11 [text/html] Saving to: ‘/dev/null’ /dev/null 100%[=====================>] 11 --.-KB/s in 0s 2017-01-16 17:29:58 (2.86 MB/s) - ‘/dev/null’ saved [11/11] real 0m7.013s user 0m0.004s sys 0m0.000s londo@peter:~/git/capmon/mojo> time wget -O /dev/null --tries=5 http://localhost:3000/ --2017-01-16 17:30:03-- http://localhost:3000/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... 200 OK Length: 11 [text/html] Saving to: ‘/dev/null’ /dev/null 100%[=====================>] 11 --.-KB/s in 0s 2017-01-16 17:30:06 (2.15 MB/s) - ‘/dev/null’ saved [11/11] real 0m3.025s user 0m0.004s sys 0m0.000s londo@peter:~/git/capmon/mojo> time wget -O /dev/null --tries=5 http://localhost:3000/ --2017-01-16 17:30:09-- http://localhost:3000/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... No data received. Retrying. --2017-01-16 17:30:13-- (try: 2) http://localhost:3000/ Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... No data received. Retrying. --2017-01-16 17:30:18-- (try: 3) http://localhost:3000/ Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... No data received. Retrying. --2017-01-16 17:30:24-- (try: 4) http://localhost:3000/ Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... No data received. Retrying. --2017-01-16 17:30:31-- (try: 5) http://localhost:3000/ Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... No data received. Giving up. real 0m25.018s user 0m0.004s sys 0m0.004s londo@peter:~/git/capmon/mojo> time wget -O /dev/null --tries=5 http://localhost:3000/ --2017-01-16 17:30:37-- http://localhost:3000/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost (localhost)|127.0.0.1|:3000... connected. HTTP request sent, awaiting response... 200 OK Length: 11 [text/html] Saving to: ‘/dev/null’ /dev/null 100%[=====================>] 11 --.-KB/s in 0s 2017-01-16 17:30:40 (2.69 MB/s) - ‘/dev/null’ saved [11/11] real 0m3.007s user 0m0.004s sys 0m0.000s