Apache crashing when doing concurrent requests with Symfony dev mode - apache

I'm making a symfony 3.4 application as REST service (so I have installed the usual JMS Serializer, FoSRest and lexik/jwt-authentication-bundle) and testing it on XAMPP (Windows 10).
When i make XHR requests through my frontend application using app_dev.php as endpoint it (very) often happens that Apache crashes when making 2+ requests at the same time.
Reading here and there it looks like that this issue is often caused by an attempt to write on the session file since symfony default session handler is session.handler.native_file.
So i first tried to put null (which, according to the documentation, uses native PHP session handler), this made the crashes happen less often but didn't fix the issue completely
Then i tried using Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler which made the crashes happen even less than before, but there's still the occasional crash
Now that i'm using a database as session handler though i'm noticing that no session is being written on the database when i make XHR requests (While it does if i open a normal web page served by the application), which shouldn't surprise me since I set my security.yml such that the REST routes must be stateless, and yet toying with the handler_id configuration influences how often my apache crashes
The same thing doesn't happen if I open multiple web pages served by the same application, nor it happens if I use the production endpoint (app.php).
Is there any way to fix this completely?
EDIT:
As requested
Can you add the apache error logs and php error logs?
It just repeats like this for each time it restarted. I have noticed this line: AH00428: Parent: child process 29076 exited with status 3221226356 -- Restarting. which might be interesting investigating upon
[Sun Dec 17 00:39:58.548676 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00428: Parent: child process 22856 exited with status 3221226356 -- Restarting.
[Sun Dec 17 00:39:59.544151 2017] [ssl:warn] [pid 17564:tid 532] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:39:59.740710 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00455: Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/7.1.7 configured -- resuming normal operations
[Sun Dec 17 00:39:59.740710 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00456: Apache Lounge VC14 Server built: Jun 15 2017 12:39:41
[Sun Dec 17 00:39:59.740710 2017] [core:notice] [pid 17564:tid 532] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun Dec 17 00:39:59.746705 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00418: Parent: Created child process 29076
[Sun Dec 17 00:40:01.201423 2017] [ssl:warn] [pid 29076:tid 592] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:01.414295 2017] [ssl:warn] [pid 29076:tid 592] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:01.455312 2017] [mpm_winnt:notice] [pid 29076:tid 592] AH00354: Child: Starting 150 worker threads.
[Sun Dec 17 00:40:17.006680 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00428: Parent: child process 29076 exited with status 3221226356 -- Restarting.
[Sun Dec 17 00:40:17.371667 2017] [ssl:warn] [pid 17564:tid 532] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:17.403690 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00455: Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/7.1.7 configured -- resuming normal operations
[Sun Dec 17 00:40:17.403690 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00456: Apache Lounge VC14 Server built: Jun 15 2017 12:39:41
[Sun Dec 17 00:40:17.403690 2017] [core:notice] [pid 17564:tid 532] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun Dec 17 00:40:17.409694 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00418: Parent: Created child process 24332
[Sun Dec 17 00:40:18.667139 2017] [ssl:warn] [pid 24332:tid 524] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:18.858441 2017] [ssl:warn] [pid 24332:tid 524] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:18.895469 2017] [mpm_winnt:notice] [pid 24332:tid 524] AH00354: Child: Starting 150 worker threads.
[Sun Dec 17 00:40:20.972550 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00428: Parent: child process 24332 exited with status 3221226356 -- Restarting.
[Sun Dec 17 00:40:21.481091 2017] [ssl:warn] [pid 17564:tid 532] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:21.513627 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00455: Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/7.1.7 configured -- resuming normal operations
[Sun Dec 17 00:40:21.513627 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00456: Apache Lounge VC14 Server built: Jun 15 2017 12:39:41
[Sun Dec 17 00:40:21.513627 2017] [core:notice] [pid 17564:tid 532] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun Dec 17 00:40:21.519144 2017] [mpm_winnt:notice] [pid 17564:tid 532] AH00418: Parent: Created child process 27440
[Sun Dec 17 00:40:22.991094 2017] [ssl:warn] [pid 27440:tid 552] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:23.266105 2017] [ssl:warn] [pid 27440:tid 552] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Dec 17 00:40:23.301132 2017] [mpm_winnt:notice] [pid 27440:tid 552] AH00354: Child: Starting 150 worker threads.
When you say apache crash means that you have to start apache again,
or you just get an error? Which error do you get?
I Just get the usual application crashed window saying "Apache has stopped working", if i click "Close the application" it restarts by itself and the request that caused the crash simply fails with no status code or error message (which is expected since the connection with the server stopped). As you can see there's no specific error in the logs except for that status code
How you have setup apache and php mod_apache, php-fpm? Which apache
server limits do you have, how many php workers?
I'm not sure how to answer this question, i'm using stock apache and php from the XAMPP package with no edits to the configuration. I can tell you php is loaded as apache handler, so no CGI or FastCGI. Anyways on simple pages or using production mode in Symfony it works fine
NEWS:
I have discovered that since i was doing CORS requests it was creating a session file for each request, i fixed that and it slightly improved my issue, but it's still there
I have tried using redis as session handler for PHP but it actually made things worse
I have made a simple test where i called the same page (which uses session) 1000 times, it works fine as long as i put session_write_close(); at the end, otherwise it crashes

As stated in my last comment, I tried using FastCGI and it fixed the issue.
https://blog.tiger-workshop.com/fix-various-apache-crashes-on-windows/
On this page there are 2 suggestions for the error i was receiving AH00428: Parent: child process 29076 exited with status 3221226356 -- Restarting. One fix is to add the following lines to httpd.conf
<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>
But it didn't work. The second fix is related to a bug that happens in windows when using PHP as Apache Handler https://github.com/vlucas/phpdotenv/issues/76 so i switched to FastCGI as suggested.
These instructions are more specific to XAMPP than the ones posted in the link above. You need to edit the file xampp\apache\conf\extra\httpd-xampp.conf
Comment the following lines
#
# PHP-Module setup
#
#LoadFile "C:/xampp/php/php7ts.dll"
#LoadFile "C:/xampp/php/libpq.dll"
#LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
#
#<FilesMatch "\.php$">
# SetHandler application/x-httpd-php
#</FilesMatch>
#<FilesMatch "\.phps$">
# SetHandler application/x-httpd-php-source
#</FilesMatch>
[...] (This one is further down in the file)
#
#<IfModule php7_module>
# PHPINIDir "C:/xampp/php"
#</IfModule>
And add these lines
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
FcgidMaxProcesses 300
FcgidMaxProcessesPerClass 300
FcgidOutputBufferSize 65536
FcgidConnectTimeout 10
FcgidProcessLifeTime 0
FcgidMaxRequestsPerProcess 0
FcgidMinProcessesPerClass 0
FcgidFixPathinfo 0
FcgidProcessLifeTime 0
FcgidZombieScanInterval 20
FcgidMaxRequestLen 536870912
FcgidIOTimeout 120
FcgidTimeScore 3
FcgidPassHeader Authorization
FcgidInitialEnv PHPRC "C:\\xampp\\php"
FcgidInitialEnv PATH "C:\\xampp\\php;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;"
FcgidInitialEnv SystemRoot "C:\\Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:\\xampp\\tmp"
FcgidInitialEnv TMP "C:\\xampp\\tmp"
FcgidInitialEnv windir "C:\\Windows"
DirectoryIndex index.html index.htm index.php
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/xampp/php/php-cgi.exe" .php
</Files>
</IfModule>

Related

XAMMP Port:8080 SSL Issues - Only on Older version of XAMPP

I wonder if anyone can point me in the right direction.
Trying to host multiple websites locally, Problem with this is, there is multiple PHP versions due to them being outdated - I will fix this later.
For now, I am trying to get a second website running locally on an older version of XAMPP to match the PHP version of the website. The issue I am having is the common SSL redirect error - trying to visit the localhost/website redirects to HTTPS every time. So the website is not reachable at all.
I know you can use CGI Virtual host's for different version of PHP - That is my next avenue.
I have a version of XAMPP running 7.1 with a website and that works fine - so this version of xampp 5.4.6 I have changed to port: 8080, 444 .
Things I have tried that have not worked.
Installing SSL locally to PC
Redirect IP via Host file
Complete reinstall, re-download and re-configuration with and without SSL certs
Last line of the error logs when trying to access:
Is there no way to force this to not happen. Via website files - or could it be the Xampp version?
Error logs as follows: I see how it says the ID does not match, It does not change.
[Thu Mar 17 08:58:58.989357 2022] [core:warn] [pid 18316:tid 300] AH00098: pid file C:/xampp5/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Mar 17 08:58:59.101339 2022] [ssl:warn] [pid 18316:tid 300] AH01909: www.example.com:444:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 17 08:58:59.136882 2022] [mpm_winnt:notice] [pid 18316:tid 300] AH00455: Apache/2.4.38 (Win64) OpenSSL/1.0.2q PHP/5.6.40 configured -- resuming normal operations
[Thu Mar 17 08:58:59.136882 2022] [mpm_winnt:notice] [pid 18316:tid 300] AH00456: Apache Lounge VC11 Server built: Jan 21 2019 13:25:29
[Thu Mar 17 08:58:59.136882 2022] [core:notice] [pid 18316:tid 300] AH00094: Command line: 'c:\xampp5\apache\bin\httpd.exe -d C:/xampp5/apache'
[Thu Mar 17 08:58:59.156152 2022] [mpm_winnt:notice] [pid 18316:tid 300] AH00418: Parent: Created child process 13520
[Thu Mar 17 08:58:59.677736 2022] [ssl:warn] [pid 13520:tid 584] AH01909: www.example.com:444:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 17 08:58:59.851891 2022] [ssl:warn] [pid 13520:tid 584] AH01909: www.example.com:444:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 17 08:58:59.897765 2022] [mpm_winnt:notice] [pid 13520:tid 584] AH00354: Child: Starting 150 worker threads.

Apache shutdown unexpectedly, No ports are using but still not working

i am using Xampp from "https://www.apachefriends.org/download.html" for php version 7.1.7
I have change my ports:8080(httpd.conf) and 4433 (httpd-ss;.conf) also tried some other port but while starting Apache I found this issue every time
2:48:41 AM [Apache] Error: Apache shutdown unexpectedly.
2:48:41 AM [Apache] This may be due to a blocked port, missing dependencies,
2:48:41 AM [Apache] improper privileges, a crash, or a shutdown by another method.
2:48:41 AM [Apache] Press the Logs button to view error logs and check
2:48:41 AM [Apache] the Windows Event Viewer for more clues
2:48:41 AM [Apache] If you need more help, copy and post this
2:48:41 AM [Apache] entire log window on the forums
and Apache (error.log)
[Wed Jul 19 02:45:02.474102 2017] [ssl:warn] [pid 4832:tid 600] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jul 19 02:45:02.881341 2017] [ssl:warn] [pid 4832:tid 600] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jul 19 02:45:02.998856 2017] [mpm_winnt:notice] [pid 4832:tid 600] AH00455: Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/7.0.21 configured -- resuming normal operations
[Wed Jul 19 02:45:02.998856 2017] [mpm_winnt:notice] [pid 4832:tid 600] AH00456: Apache Lounge VC14 Server built: Jun 15 2017 12:39:41
[Wed Jul 19 02:45:02.998856 2017] [core:notice] [pid 4832:tid 600] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Jul 19 02:45:03.013855 2017] [mpm_winnt:notice] [pid 4832:tid 600] AH00418: Parent: Created child process 1088
[Wed Jul 19 02:45:04.169927 2017] [ssl:warn] [pid 1088:tid 624] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jul 19 02:45:04.693597 2017] [ssl:warn] [pid 1088:tid 624] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jul 19 02:45:04.746592 2017] [mpm_winnt:notice] [pid 1088:tid 624] AH00354: Child: Starting 150 worker threads.
and this is Service setting
Error appear error Dialogue
I am using window 10, can someone give the solve.

Apache server not responding on xampp

I know this question has been asked before, but I upgraded to windows 10. My xampp was working fine before the upgrade and now it is not. Apache does not run now. I had problems with skype before, so I removed it, which freed the port for apache.
2:06:09 PM [Apache] Port 80 in use by "Unable to open process" with PID 4!
2:06:09 PM [Apache] Apache WILL NOT start without the configured ports free!
2:06:09 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
2:06:09 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
Is there any way I can find out what is using that port and stop it? I have tried changing the port number in the config file to 8080, but it does not seem to work. Any ideas?
Here are the error logs after I changed the port to 8080:
[Thu Aug 27 14:10:10.207404 2015] [ssl:warn] [pid 3576:tid 524] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Aug 27 14:10:10.583181 2015] [ssl:warn] [pid 3576:tid 524] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Aug 27 14:10:10.755107 2015] [mpm_winnt:notice] [pid 3576:tid 524] AH00455: Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.11 configured -- resuming normal operations
[Thu Aug 27 14:10:10.755107 2015] [mpm_winnt:notice] [pid 3576:tid 524] AH00456: Apache Lounge VC11 Server built: Jul 12 2015 10:56:48
[Thu Aug 27 14:10:10.755107 2015] [core:notice] [pid 3576:tid 524] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/XAMPP/apache'
[Thu Aug 27 14:10:10.770732 2015] [mpm_winnt:notice] [pid 3576:tid 524] AH00418: Parent: Created child process 10308
[Thu Aug 27 14:10:12.035120 2015] [ssl:warn] [pid 10308:tid 572] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Aug 27 14:10:12.395328 2015] [ssl:warn] [pid 10308:tid 572] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Aug 27 14:10:12.535958 2015] [mpm_winnt:notice] [pid 10308:tid 572] AH00354: Child: Starting 150 worker threads.

Xampp Apache server not responding to request

I have installed Xampp server (xampp-win32-5.6.8-0-VC11-installer) on Windows 8 64 bit os. I have deployed the HelloWorld application folder in htdocs directory and added a virtual host in httpd-vhosts.conf file like below
<VirtualHost localhost:80>
DocumentRoot C:/xampp/htdocs/
RewriteEngine On
ProxyRequests Off
ServerName localhost
<Directory C:/xampp/htdocs/Aasifeweb/app/>
Require all granted
Allow from all
</Directory>
<Location />
ProxyPass http://localhost/Aasifeweb/app/#/home
ProxyPassReverse http://localhost/Aasifeweb/app/#/home
ProxyPassReverseCookiePath / http://localhost/Aasifeweb/app/#/home
</Location>
</VirtualHost>
Apache error Log file
[Fri Aug 07 19:23:26.149126 2015] [ssl:warn] [pid 2684:tid 448] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 07 19:23:26.200160 2015] [core:warn] [pid 2684:tid 448] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Aug 07 19:23:26.268206 2015] [ssl:warn] [pid 2684:tid 448] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 07 19:23:26.298225 2015] [mpm_winnt:notice] [pid 2684:tid 448] AH00455: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 configured -- resuming normal operations
[Fri Aug 07 19:23:26.298225 2015] [mpm_winnt:notice] [pid 2684:tid 448] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Fri Aug 07 19:23:26.298225 2015] [core:notice] [pid 2684:tid 448] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Aug 07 19:23:26.301227 2015] [mpm_winnt:notice] [pid 2684:tid 448] AH00418: Parent: Created child process 3576
AH00548: NameVirtualHost has no effect and will be removed in the next release C:/xampp/apache/conf/extra/httpd-vhosts.conf:20
[Fri Aug 07 19:23:26.763535 2015] [ssl:warn] [pid 3576:tid 448] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 07 19:23:26.885617 2015] [ssl:warn] [pid 3576:tid 448] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 07 19:23:26.918638 2015] [mpm_winnt:notice] [pid 3576:tid 448] AH00354: Child: Starting 150 worker threads.
[Fri Aug 07 19:23:29.637450 2015] [mpm_winnt:error] [pid 3576:tid 4852] AH00326: Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting
This problem occurs when i add virtual host configuration to the httpd-vhosts.conf file. When i remove the virtual host, the server seems to respond. The deployed application is written in angular-js framework
Important: The request seems to be appending the resource path again and again. But, I'm not sure why this happens?
GET /Aasifeweb/app/%23/homeAasifeweb/app/%23/homeAasifeweb/app/%23/homeAasifeweb/app/%23
When I hit http://localhost in browser, it keeps loading. There are lot of solutions in the internet, but nothing works for me.
Things I have tried to solve the problem
I have done netsh winsock reset
I have changed the port of the
apache server
I have disabled skype and antivirus
Please let me know your views
I didn't have to use ProxyPass at all. I just had to point the directory and Angularjs - ng-route takes care of page routing.
<VirtualHost localhost:80>
DocumentRoot C:/xampp/htdocs/Aasifeweb/app
</VirtualHost>

Apache restarting on its own and errors on log

I have three separate boxes running Apache 2.4, all with the same config and modules. On CentOS 7, Apache 2.4, PHP 5.6.
Two issues that could possibly be related. On one hand, I have not forced a restart, yet it would appear that apache restarted itself based on error_log being purged and having the below.
Second issue are the actual errors or warnings displayed. I can't figure out how to resolve them and if they could be the reason that Apache restarts itself in the first place, or be creating other issues elsewhere.
[Sun Jul 19 03:39:02.241577 2015] [auth_digest:notice] [pid 904] AH01757: generating secret for digest authentication ...
[Sun Jul 19 03:39:02.243161 2015] [lbmethod_heartbeat:notice] [pid 904] AH02282: No slotmem from mod_heartmonitor
[Sun Jul 19 03:39:02.246337 2015] [ssl:warn] [pid 904] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Sun Jul 19 03:39:02.292119 2015] [mpm_prefork:notice] [pid 904] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips configured -- resuming normal operations
[Sun Jul 19 03:39:02.292151 2015] [core:notice] [pid 904] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
Would appreciate any guidance?