Mojolicious generates two responses for one request - perl

When a route callback takes too long mojolicious seems to request that route twice for example in this app:
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $c = shift;
$c->render_later;
sleep(15);
say "got here";
$c->render(template => 'index');
};
When I request the "/" route ONCE this is what I get in the logs:
[Sun Jan 31 20:53:17 2016] [debug] Your secret passphrase needs to be changed
[Sun Jan 31 20:53:17 2016] [debug] GET "/"
[Sun Jan 31 20:53:17 2016] [debug] Routing to a callback
got here
[Sun Jan 31 20:53:32 2016] [debug] Rendering template "index.html.ep" from DATA section
[Sun Jan 31 20:53:32 2016] [debug] Rendering template "layouts/default.html.ep" from DATA section
[Sun Jan 31 20:53:32 2016] [debug] 200 OK (15.007044s, 0.067/s)
[Sun Jan 31 20:53:32 2016] [debug] GET "/"
[Sun Jan 31 20:53:32 2016] [debug] Routing to a callback
got here
[Sun Jan 31 20:53:47 2016] [debug] Rendering cached template "index.html.ep" from DATA section
[Sun Jan 31 20:53:47 2016] [debug] Rendering cached template "layouts/default.html.ep" from DATA section
[Sun Jan 31 20:53:47 2016] [debug] 200 OK (15.005030s, 0.067/s)
So I wait twice the time, I noticed this because I have an app that has to download XML and extract information and it was taking forever.

As duskwuff mentioned already, it seems to be a browser issue. With the above file and an "app->start" appended, I can reproduce it with Mojolicious 6.14 and Chrome 48. Using Firefox 44, there is only one request though.
Seems like the Chrome devs make the typical user behavior of hammering "reload" when a site takes too long the default already.

Related

Can't start MAMP servers

i am unable to start servers, the 'start servers'-icon flashes green for a second and nothing happens. This is what i get in the apache_error log:
[Mon Dec 26 03:36:16 2016] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Dec 26 03:36:17 2016] [notice] Digest: generating secret for digest authentication ...
[Mon Dec 26 03:36:17 2016] [notice] Digest: done
[Mon Dec 26 03:36:18 2016] [notice] Apache/2.2.31 (Win32) DAV/2 mod_ssl/2.2.31 OpenSSL/1.0.2e mod_fcgid/2.3.9 mod_wsgi/3.4 Python/2.7.6 PHP/7.0.9 mod_perl/2.0.8 Perl/v5.16.3 configured -- resuming normal operations
[Mon Dec 26 03:36:18 2016] [notice] Server built: May 6 2016 10:19:53
[Mon Dec 26 03:36:18 2016] [crit] (22)Invalid argument: Parent: Failed to create the child process.
[Mon Dec 26 03:36:18 2016] [crit] (OS 6)Invalid reference. : master_main: create child process failed. Exiting.
I had the same problem on Windows 10 and disabling Perl worked for me:
C:\MAMP\conf\apache\httpd.conf
...
LoadModule perl_module modules/mod_perl.so
...
I hope this helps.

XAMPP Apache won't start after i added phpPgAdmin alias

I want to install phpPgAdmin with XAMPP on Windows. After i did all the steps, my Apache module on XAMPP won't start. I got this error log
[Mon Nov 14 16:36:16.661538 2016] [ssl:warn] [pid 10612:tid 504] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 14 16:36:16.824335 2016] [core:warn] [pid 10612:tid 504] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Nov 14 16:36:16.924133 2016] [ssl:warn] [pid 10612:tid 504] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 14 16:36:17.724645 2016] [mpm_winnt:notice] [pid 10612:tid 504] AH00455: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9 configured -- resuming normal operations
[Mon Nov 14 16:36:17.724645 2016] [mpm_winnt:notice] [pid 10612:tid 504] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:09:37
[Mon Nov 14 16:36:17.724645 2016] [core:notice] [pid 10612:tid 504] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Mon Nov 14 16:36:17.724645 2016] [mpm_winnt:notice] [pid 10612:tid 504] AH00418: Parent: Created child process 7288
[Mon Nov 14 16:36:18.611254 2016] [ssl:warn] [pid 7288:tid 584] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 14 16:36:18.796715 2016] [ssl:warn] [pid 7288:tid 584] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 14 16:36:18.850157 2016] [mpm_winnt:notice] [pid 7288:tid 584] AH00354: Child: Starting 150 worker threads.
[Mon Nov 14 16:36:22.814454 2016] [mpm_winnt:crit] [pid 7288:tid 584] AH02538: Child: Parent process exited abruptly. Child process is ending
I tried to remove the phpPgAdmin alias from httpd-xamp.conf, and it worked again, but my phpPgAdmin won't work (obviously).
I've uncommented the php_pgsql.dll and php_pdo_pgsql.dll extension at php.ini
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
This is my configuration on config.inc.php from phpPgAdmin folder
$conf['servers'][0]['host'] = 'localhost';
$conf['servers'][0]['pg_dump_path'] = 'C:\xampp\pgsql\9.3\bin\pg_dump.exe';
$conf['servers'][0]['pg_dumpall_path'] = 'C:\xampp\pgsql\9.3\bin\pg_dumpall.exe';
$conf['extra_login_security'] = false;
This is my alias configuration on httpd-xampp.conf
Alias /phppgadmin “C:/xampp/phpPgAdmin/”
<Directory “C:/xampp/phpPgAdmin”>
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
I'm new with XAMPP and PHP, so i don't know what's the problem. Anyone can help?
I don't know whether my answer is not too late, but you just need to change curly braces “” in your paths to regular ones "", like this
"C:/xampp/phppgadmin/"

xamps vs xibo - Appache stop working

I am using xibo open source on localhost server, recently I got error "Appache stop working"
I checked the error logs:
[Wed Sep 21 08:34:20.257000 2016] [mpm_winnt:notice] [pid 5204:tid 232] AH00428: Parent: child process 3964 exited with status 255 -- Restarting.
[Wed Sep 21 08:34:20.915000 2016] [ssl:warn] [pid 5204:tid 232] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Sep 21 08:34:20.987000 2016] [mpm_winnt:notice] [pid 5204:tid 232] AH00455: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 configured -- resuming normal operations
[Wed Sep 21 08:34:20.987000 2016] [mpm_winnt:notice] [pid 5204:tid 232] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Wed Sep 21 08:34:20.987000 2016] [core:notice] [pid 5204:tid 232] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Sep 21 08:34:20.989000 2016] [mpm_winnt:notice] [pid 5204:tid 232] AH00418: Parent: Created child process 2700
[Wed Sep 21 08:34:24.188000 2016] [ssl:warn] [pid 684:tid 232] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Sep 21 08:34:24.293000 2016] [core:warn] [pid 684:tid 232] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Sep 21 08:34:24.530000 2016] [ssl:warn] [pid 684:tid 232] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Sep 21 08:34:24.605000 2016] [mpm_winnt:notice] [pid 684:tid 232] AH00455: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 configured -- resuming normal operations
[Wed Sep 21 08:34:24.605000 2016] [mpm_winnt:notice] [pid 684:tid 232] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Wed Sep 21 08:34:24.605000 2016] [core:notice] [pid 684:tid 232] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Sep 21 08:34:24.608000 2016] [mpm_winnt:notice] [pid 684:tid 232] AH00418: Parent: Created child process 5364
[Wed Sep 21 08:34:25.607000 2016] [ssl:warn] [pid 5364:tid 248] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Sep 21 08:34:25.944000 2016] [ssl:warn] [pid 5364:tid 248] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Sep 21 08:34:26.015000 2016] [mpm_winnt:notice] [pid 5364:tid 248] AH00354: Child: Starting 150 worker threads.
httpd.conf
http://pastebin.com/1QbmV4xV
httpd-ssl.conf
http://pastebin.com/X5vStUZu
Can you please help me how to fix this issue?

CQ/AEM Dispatcher does not flush Binaries

Our application imports binaries (mostly PDF) from a legacy system and stores them on a page together with some metadata.
If there was a change the page automatically gets activated. We see the replication events in the replication log and also on the dispatcher an invalidate event is logged. But there is no eviction entry and this the old binary is still cached.
We also have HTML pages next to these container pages for the binaries and they work as expected. Here the two log entries for the successful html and the unsuccessful PDF:
OK:
[Thu Jul 03 09:26:33 2014] [D] [27635(24)] Found farm website for localhost:81
[Thu Jul 03 09:26:33 2014] [D] [27635(24)] checking [/dispatcher/invalidate.cache]
[Thu Jul 03 09:26:33 2014] [I] [27635(24)] Activation detected: action=Activate [/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/test]
[Thu Jul 03 09:26:33 2014] [I] [27635(24)] Touched /app/C2Z/dyn/c2zcqdis/docroot/.stat
[Thu Jul 03 09:26:33 2014] [I] [27635(24)] Evicted /app/C2Z/dyn/c2zcqdis/docroot/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/test.html
[Thu Jul 03 09:26:33 2014] [D] [27635(24)] response.status = 200
[Thu Jul 03 09:26:33 2014] [D] [27635(24)] response.headers[Server] = "Communique/2.6.3 (build 5221)"
[Thu Jul 03 09:26:33 2014] [D] [27635(24)] response.headers[Content-Type] = "text/html"
[Thu Jul 03 09:26:33 2014] [D] [27635(24)] cache flushed
[Thu Jul 03 09:26:33 2014] [I] [27635(24)] "GET /dispatcher/invalidate.cache" 200 13 2ms
Not OK
[Thu Jul 03 09:30:45 2014] [D] [27635(24)] Found farm website for localhost:81
[Thu Jul 03 09:30:45 2014] [D] [27635(24)] checking [/dispatcher/invalidate.cache]
[Thu Jul 03 09:30:45 2014] [I] [27635(24)] Activation detected: action=Activate [/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf]
[Thu Jul 03 09:30:45 2014] [I] [27635(24)] Touched /app/C2Z/dyn/c2zcqdis/docroot/.stat
[Thu Jul 03 09:30:45 2014] [D] [27635(24)] response.status = 200
[Thu Jul 03 09:30:45 2014] [D] [27635(24)] response.headers[Server] = "Communique/2.6.3 (build 5221)"
[Thu Jul 03 09:30:45 2014] [D] [27635(24)] response.headers[Content-Type] = "text/html"
[Thu Jul 03 09:30:45 2014] [D] [27635(24)] cache flushed
[Thu Jul 03 09:30:45 2014] [I] [27635(24)] "GET /dispatcher/invalidate.cache" 200 13 1ms
The PDF in this case is stored in a node called 'download' directly below the jcr:content node. It's html container is never called directly and this is not available on the dispatcher. So a user directly requests the file:
/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf/jcr%3acontent/download/file.res/as2p_vvm_ch_gl_fix_chf_.pdf
In the dispatcher.any we flush all html pages on activation, but not for the binaries. For testing, we added an allow *.pdf but this didn't help anyway.
/invalidate
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "*.html"
/type "allow"
}
}
In my opinion, the invalidate call should just delete the whole folder:
/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf
Any ideas why our binaries do not get flushed?
UPDATE: In another post the statfileslevel property in the dispatcher.any is mentioned. In our environment this is commented out. Could it be that this could be the problem. Sadly I don't fully understand how this is supposed to work. Is the level meant from the wwwroot or from the page that is activated?
It looks like your problem with dispatcher flushing is that the path the file is being served from is using jcr%3acontent when it should use _jcr_content.
Dispatcher flushing deletes the folder _jcr_content under the path that is being flushed. It does not delete jcr%3acontent (urldecoded as jcr:content). So you should instead serve the pdf using this URL:
/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf/_jcr_content/download/file.res/as2p_vvm_ch_gl_fix_chf_.pdf
This would then cache the pdf file under:
{CACHEROOT}/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf/_jcr_content/download/file.res/as2p_vvm_ch_gl_fix_chf_.pdf
Then when this path is flushed it will delete the subdirectory _jcr_content under the path of the flush
/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf
To go into more detail, when you issue a flush request for path above then the following files and directories are deleted:
/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf.* where * is a wildcard
/content/offering/s2p/en/offerings/documents/Swiss_Mandate_Line/Review/as2p_vvm_ch_gl_fix_chf__pdf/_jcr_content
See slide 23 in this presentation for details on how flushing works:
http://www.slideshare.net/andrewmkhoury/aem-cq-dispatcher-caching-webinar-2013
Not sure if this is the root cause, but what I suspect you probably need to do, is to go to localhost:4503/etc/replication/agents.publish.html (note, this is a publish instance, you can do it on the author and replicate the replication agents et al, but for the purposes of the POC, just do it directly on the publisher.)
Then go to your dispatcher flush agent, and click on edit settings.
Go to the triggers panel.
Make sure that the "On Receive" trigger is checked. What this does is enable chain replication, meaning that when a direct asset is published, it is directly deleted from the dispatcher, causing a miss on the next request, and thus pulling a fresh copy from the dispatcher.
Note that this kind of flushing is distinct from the stats file level flushing, which only flushes a directory, rather than a fully qualified path to the asset.
By the way, it's not stats file level. The stats file level by default is 0 if it is commented out, which invalidates anything below. What you seem to be looking for is an active delete of the cache. This is possible, as Dave just outlined to me for an unrelated problem in this post:
Is it possible to recursively flush directories in the CQ5/AEM apache dispatcher?
An approach would be to create a flush interceptor. Essentially a custom servlet on the publisher. What you would then do, is to configure the normal flush replicator to make a call to the local servlet on the publisher.
The servlet then detects whether it would need to delete the directory, or any particular files within. It can transform the flush path to the required path, and instead of a FLUSH action, use a DELETE action.
It would still be very important to send the flush to the normal dispatcher location.
Hope this helps.

Error with Schedulers and Inbound Emails in sugarcrm

We use SugarCRM CE 6.5.16 on Centos 6.5.
I am getting this error :
Wed Apr 9 15:37:10 2014 [10389][1][ERROR] Unable to load custom logic file: include/SugarSearchEngine/SugarSearchEngineQueueManager.php
The real problem is that i dont receive emails from my inbound email.
They are all set up.I added the cron job to the crontab. Well actually I receive some emails, like 3 or 4 from 100. In the schedulers the job status is "running" and last successful run is "Never".
Every other scheduler job has a status "Done" and has last successful run.
I repaired inbound emails , scheduler jobs but with no effect.
The only thing i found is this :
http://suitecrm.com/forum/search?query=SugarSearchEngineQueueManager&searchdate=all&childforums=1
So I commented out this code and i no longer get the error but still I don't receive emails.
I don't know what else to do.
Please help me if you can !Thanks !
EDIT
I found that
"This file is only included in PRO version and it's useless in Community Edition.
Code Fix:
1. Comment code in /custom/Extension/application/Ext/LogicHooks/SugarFTSHooks.php
Do a Fast Rebuild from Administration (index.php?module=Administration&action=repair). This process will rebuild the piece of code that uses the SugarCRM to call inexistent file SugarSearchEngineQueueManager /custom/application/Ext/LogicHooks/logichooks.ext.php"
So I commented out the code and did the rebuild (yeah i did it before but now i know for sure that this file should not be in Sugarcrm CE )
The error doesn't show anymore but my scheduler still stays "running" and nothings happens , except:
When i did this (What Matthew Poer said) , I received 4 emails just like before... so something is causing a problem.
delete from job_queue where scheduler_id = 'THE_SCHEDULER_ID';
update schedulers set last_run = subdate(now(),360) where id = 'THE_SCHEDULER_ID';
EDIT 2:
This is from php error_log
[Sun Apr 13 03:34:27 2014] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 13 03:34:27 2014] [notice] Digest: done
[Sun Apr 13 03:34:33 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_nss/2.2.15 NSS/3.14.0.0 Basic ECC PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_wsgi/3.2 Python/2.6.6 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Sun Apr 13 12:22:52 2014] [error] [client 122.155.18.51] File does not exist: /usr/share/phpMyAdmin/translators.html
[Sun Apr 13 13:45:31 2014] [error] [client 122.155.18.51] File does not exist: /usr/share/phpMyAdmin/translators.html
[Sun Apr 13 15:43:39 2014] [error] [client 66.249.66.74] File does not exist: /opt/otrs/var/httpd/htdocs/js/js-cache/ModuleJS_784dc12bf89d72db064caa6e8690168b.js
[Sun Apr 13 15:43:40 2014] [error] [client 66.249.66.74] File does not exist: /opt/otrs/var/httpd/htdocs/skins/Customer/default/css-cache/CommonCSS_b1f924c426a0e1a9f1553197a2ce25a4.css
[Sun Apr 13 15:43:41 2014] [error] [client 66.249.66.74] File does not exist: /opt/otrs/var/httpd/htdocs/js/js-cache/CommonJS_7f98ddff2f339e3b515f7901d82600bb.js
[Mon Apr 14 11:09:04 2014] [error] [client 192.168.10.1] PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/share/phpMyAdmin/version_check.php on line 16, referer: http://support.expert-m.net/phpmyadmin/main.php?token=d2e60372f8b5d6d53f0c3c80a536be27
[Mon Apr 14 11:09:04 2014] [error] [client 192.168.10.1] PHP Warning: file_get_contents(http://www.phpmyadmin.net/home_page/version.json): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/share/phpMyAdmin/version_check.php on line 16, referer: http://support.expert-m.net/phpmyadmin/main.php?token=d2e60372f8b5d6d53f0c3c80a536be27
[Mon Apr 14 12:45:25 2014] [error] [client 178.235.72.68] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
This is from the logs folder of SugarCRM, error.log
[Mon Apr 14 08:58:59 2014] [error] [client 192.168.10.1] PHP Notice: Undefined index: 8854a79c-6171-036c-e7df-534548e8bc81 in /var/www/sugarcrm/public_html/modules/Emails/EmailUIAjax.php on line 879, referer: http://sugarcrm.support.expert-m.net/index.php?module=Emails&action=index&parentTab=All
[Mon Apr 14 08:58:59 2014] [error] [client 192.168.10.1] PHP Notice: Undefined index: 8854a79c-6171-036c-e7df-534548e8bc81 in /var/www/sugarcrm/public_html/modules/Emails/EmailUIAjax.php on line 880, referer: http://sugarcrm.support.expert-m.net/index.php?module=Emails&action=index&parentTab=All
[Mon Apr 14 11:22:17 2014] [error] [client 192.168.10.1] PHP Notice: Undefined index: 8854a79c-6171-036c-e7df-534548e8bc81 in /var/www/sugarcrm/public_html/modules/Emails/EmailUIAjax.php on line 879, referer: http://sugarcrm.support.expert-m.net/index.php?module=Emails&action=index&parentTab=All
[Mon Apr 14 11:22:17 2014] [error] [client 192.168.10.1] PHP Notice: Undefined index: 8854a79c-6171-036c-e7df-534548e8bc81 in /var/www/sugarcrm/public_html/modules/Emails/EmailUIAjax.php on line 880, referer: http://sugarcrm.support.expert-m.net/index.php?module=Emails&action=index&parentTab=All
[Mon Apr 14 11:24:47 2014] [error] [client 192.168.10.1] File does not exist: /var/www/sugarcrm/public_html/favicon.ico
I didn't paste all the info from the logs. There is more but the errors are repeating.
The file include/SugarSearchEngine/SugarSearchEngineQueueManager.php won't exist in your system because it's a Pro+ feature.
To reset a scheduler entry that got "stuck," delete the scheduler information from the job queue in the database and reset the last_run value. Find the ID of the scheduler from the URL within SugarCRM or by select id,name from schedulers. Once you have the ID of this scheduler, run this two queries:
delete from job_queue where scheduler_id = 'THE_SCHEDULER_ID';
update schedulers set last_run = subdate(now(),360) where id = 'THE_SCHEDULER_ID';