Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Users get disconnected - fatal erealloc |
|
Author |
|
MAU123
Joined: 14 Mar 2012 Posts: 3 Location: France, Paris
|
Posted: Wed 14 Mar '12 15:06 Post subject: Users get disconnected - fatal erealloc |
|
|
Hello,
We have developed an application in PHP and currently have 2000 users every day, with a daily peak of 1600 users within 30 minutes. The rest of the day, there are about 500 users connected on average.
It seemed to work fine for several month but now we have some users who get disconnected with no obvious reasons. The number of users has recently increased from 1600 to nearly 2000.
Users get two types of error messages :
- Type 1 : Internet explorer can not load this page
- Type 2 : the access to the data server is not possible
The environment is :
- PHP 4
- MY SQL version 5.0.52
- APACHE 2.0
- Windows 2003, sp3
Everything is installed on the same machine.
Physical memory (K)
Total : 4193500
Available : 3225892
System cache : 2111156
In the MySQL Log file we do not have any errors.
However, in the Apache Logfile we get reoccurring errors : Code: |
[Thu Mar 08 09:13:23 2012] [error] [client XX.XXX.XXX.X] PHP Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\lcl\\lcl_stat\\lib\\sgbd\\mysql.class.php on line 60, referer: http://XXXXX.XX.fr.cly/XXX/lXXX_stat/index.php?page=3
FATAL: erealloc(): Unable to allocate 90112 bytes
[Thu Mar 08 09:14:07 2012] [notice] Parent: child process exited with status 1 -- Restarting.
[Thu Mar 08 09:14:07 2012] [notice] Parent: Created child process 4196
[Thu Mar 08 09:14:07 2012] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Mar 08 09:14:07 2012] [notice] Child 4196: Child process is running
[Thu Mar 08 09:14:07 2012] [notice] Child 4196: Acquired the start mutex.
[Thu Mar 08 09:14:07 2012] [notice] Child 4196: Starting 350 worker threads.
[Thu Mar 08 09:14:07 2012] [notice] Child 4196: Listening on port 80.
[Thu Mar 08 09:14:33 2012] [error] [client XX.XXX.XXX.X] PHP Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\XXX\\lib\\sgbd\\mysql.class.php on line 62, referer: http://XXXXX.XX.fr.cly/XXX/lXXX_stat/index.php?page=3
[Thu Mar 08 09:14:33 2012] [error] [client XX.XXX.XXX.X] PHP Notice: Use of undefined constant NOMDUSITE - assumed 'NOMDUSITE' in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\XXX\\lib\\sgbd.inc.php on line 24, referer: http://XXXXX.XX.fr.cly/XXX/lXXX_stat/index.php?page=3
FATAL: erealloc(): Unable to allocate 22528 bytes
[Thu Mar 08 09:14:43 2012] [notice] Parent: child process exited with status 1 -- Restarting.
[Thu Mar 08 09:14:43 2012] [notice] Parent: Created child process 1920
[Thu Mar 08 09:14:43 2012] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Mar 08 09:14:43 2012] [notice] Child 1920: Child process is running
[Thu Mar 08 09:14:43 2012] [notice] Child 1920: Acquired the start mutex.
[Thu Mar 08 09:14:43 2012] [notice] Child 1920: Starting 350 worker threads.
[Thu Mar 08 09:14:43 2012] [notice] Child 1920: Listening on port 80.
[Thu Mar 08 09:14:53 2012] [error] [client 10.223.23.5] PHP Notice: Undefined variable: id_vue in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\XXX\\XXX_stat\\module\\referentiel\\statistiques.php on line 282, referer: http://XXXXX.XX.fr.cly/XXX/lXXX_stat/index.php?page=4
[Thu Mar 08 09:14:53 2012] [error] [client 10.XXX.XX.X] PHP Notice: Undefined variable: libelle_vue in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\XXX\\XXX_stat\\module\\referentiel\\statistiques.php on line 282, referer: http://XXXXX.XX.fr.cly/XXX/lXXX_stat/index.php?page=4
FATAL: erealloc(): Unable to allocate 90112 bytes
[Thu Mar 08 09:15:14 2012] [notice] Parent: child process exited with status 1 -- Restarting.
/…./
[Mon Mar 12 08:53:33 2012] [notice] Child 4640: Listening on port 80.
[Mon Mar 12 08:54:05 2012] [error] [client XX.XXX.XX.XX] request failed: error reading the headers, referer: http://XXXX.XX.fr.cly/XXX/XXX_stat/index.php?page=2
FATAL: erealloc(): Unable to allocate 90112 bytes
[Mon Mar 12 08:54:08 2012] [notice] Parent: child process exited with status 1 -- Restarting.
[Mon Mar 12 08:54:08 2012] [notice] Parent: Created child process 5676
[Mon Mar 12 08:54:08 2012] [notice] Disabled use of AcceptEx() WinSock2 API
[Mon Mar 12 08:54:08 2012] [notice] Child 5676: Child process is running
[Mon Mar 12 08:54:08 2012] [notice] Child 5676: Acquired the start mutex.
[Mon Mar 12 08:54:08 2012] [notice] Child 5676: Starting 350 worker threads.
[Mon Mar 12 08:54:08 2012] [notice] Child 5676: Listening on port 80.
FATAL: erealloc(): Unable to allocate 360448 bytes
[Mon Mar 12 08:54:40 2012] [notice] Parent: child process exited with status 1 -- Restarting. |
In the previous log file, confidential customer information has been replaced by Xs for security reasons.
Code: | - Main APACHE SETTINGS -
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_winnt.c>
ThreadsPerChild 350
MaxRequestsPerChild 0
</IfModule>
Listen 80
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imap_module modules/mod_imap.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule userdir_module modules/mod_userdir.so
UseCanonicalName Off
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
Options Indexes FollowSymLinks
AllowOverride None
- Main PHP settings -
max_execution_time = 10800
max_input_time = 60
memory_limit = 128M
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.connect_timeout = 60
mysql.trace_mode = Off
- Main MySQL settings -
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=800
query_cache_size=84M
table_cache=1520
tmp_table_size=85M
thread_cache_size=38
myisam_max_sort_file_size=100G
myisam_max_extra_sort_file_size=100G
myisam_sort_buffer_size=170M
key_buffer_size=300M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
innodb_additional_mem_pool_size=6M
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=3M |
This problem is critical for us
Can anybody please help ?
Thank-you very much |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Thu 15 Mar '12 13:04 Post subject: |
|
|
Looks like php related.
You are using outdated/legacy PHP 4 and Apache 2.0, not anymore supported for quite some time.
It is a known issue with a PHP before 5.3 that it has memory management and stability issues.
The most common solution for this kinfd of errors was using PHP with Fast CGI (mod_fcgid). I do not know there is still somewhere a version for Apache 2.0.
Also I see also PHP warnings: Undefined variable: id_vue libelle_vue.
Steffen |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 15 Mar '12 21:21 Post subject: |
|
|
Quote: |
statistiques.php on line 282
|
What is arround that line? My guess is you should increase memory_limit in your php.ini
Like
memory_limit = 32M |
|
Back to top |
|
MAU123
Joined: 14 Mar 2012 Posts: 3 Location: France, Paris
|
Posted: Fri 16 Mar '12 17:35 Post subject: |
|
|
Steffen wrote: | Looks like php related.
You are using outdated/legacy PHP 4 and Apache 2.0, not anymore supported for quite some time.
It is a known issue with a PHP before 5.3 that it has memory management and stability issues.
The most common solution for this kinfd of errors was using PHP with Fast CGI (mod_fcgid). I do not know there is still somewhere a version for Apache 2.0.
Also I see also PHP warnings: Undefined variable: id_vue libelle_vue.
Steffen |
Hello Steffen,
Thank-you very much for your reply.
We found a fast CGI compatible with Apache 2.0.
We have been trying since yesterday to install that module but Apache does not want to work with it. So, we are now trying to migrate to PHP 5.3.
Meanwhile we have done some more load performance testing (from 50 to 200 users in 5 minutes). We found out that with a ThreadsPerChild below 100 in httpd.conf, there was no more Apache restart (and no more Fatal erealloc). However, this setting drastically impact the user response time and can not be a solution. If we increase the ThreadsPerChild above 100 we start getting again the Apache restarts and the Fatal realloc. |
|
Back to top |
|
MAU123
Joined: 14 Mar 2012 Posts: 3 Location: France, Paris
|
Posted: Fri 16 Mar '12 17:42 Post subject: |
|
|
James Blond wrote: | Quote: |
statistiques.php on line 282
|
What is arround that line? My guess is you should increase memory_limit in your php.ini
Like
memory_limit = 32M |
Hello James
Thank-you also for your response
You will see hereunder what is around these lines :
Code: |
$libel = 'Consultation marche profil';
//recherche du libelle marche/profil
$strRequete = 'SELECT vueid, libcourt from vuemarcheprofil where vueid =' . $MEM->get ( COL_MARCHEPROFIL );
$SGBD->query ( $strRequete );
while ( $SGBD->next_record () ) {
$libelle_vue = $SGBD->result ( 'libcourt' );
$id_vue = $SGBD->result ( 'vueid' );
}
$STAT->clic_normal ( $statactif, $adr_ip, $session_id, $libel, $numstructcom, $axecourant, $niveau, $id_vue, $libelle_vue );
break;
case 'clic_valide_classement_reporting' :
$libel = 'Clic classement menu reporting';
$STAT->clic_normal ( $statactif, $adr_ip, $session_id, $libel, $numstructcom, $axecourant, $niveau );
$libel = 'Visite page classement';
$STAT->clic_normal ( $statactif, $adr_ip, $session_id, $libel, $numstructcom, $axecourant, $niveau );
break;
Line number 182 is the following one :
$STAT->clic_normal ( $statactif, $adr_ip, $session_id, $libel, $numstructcom, $axecourant, $niveau, $id_vue, $libelle_vue );
$STAT->clic_normal la fonction qui écrit dans la table stat_log
|
We have also been tweaking the Memory limit parameter with the following values : 128, 256 and -20, but it did not change the problem.
So, we are still open to any suggestions/ solutions. |
|
Back to top |
|
|
|
|
|
|