Web Hosting Talk


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : How to disable apache generating coredump file?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)

 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-28-2008, 01:22 PM
rumahweb rumahweb is offline
View Beta Profile
Junior Guru Wannabe
 
Join Date: May 2005
Location: Indonesia
Posts: 35
* How to disable apache generating coredump file?

Recently I use suphp with fcgi on my cPanel Server. When I apply RLimitCPU for each vhost, I see that some scripts that potentially overloading the server is killed. I think this is a good way to control load on server.

But each time a php process killed, apache create a coredump files under users's directory that is large enough to fill user's space limit.

How to disable apache from creating core dump files?

I have try :
- set "ulimit -c 0" on users and root
- set "/proc/sys/fs/suid_dumpable" to 0
- set /etc/security/limits.conf with 0 limit for core parameter
- set CoreDumpDirectory to specific directory

Nothing works to stop apache from generating coredump files

FYI, my system is :
- CENTOS Enterprise 5.2 x86_64
- Apache/2.2.9
- PHP 5.2.6 (cli) (built: Jun 26 2008 01:07:50)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with the ionCube PHP Loader v3.1.33, Copyright (c) 2002-2007, by ionCube Ltd., and
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Suhosin v0.9.23, Copyright (c) 2007, by SektionEins GmbH
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
- FCGI & suPHP

__________________
Best Web Hosting in Indonesia
http://www.rumahweb.com


Last edited by rumahweb; 06-28-2008 at 01:34 PM. Reason: additional info
Reply With Quote
Sponsored Links
  #2  
Old 06-28-2008, 02:23 PM
johnny-l johnny-l is offline
View Beta Profile
Aspiring Evangelist
 
Join Date: May 2007
Location: italy
Posts: 393
Quote:
Originally Posted by rumahweb View Post
But each time a php process killed, apache create a coredump files under users's directory
Are you sure is Apache creating the Core Dump, and not PHP ?

__________________
"I want" never gets ...

Reply With Quote
  #3  
Old 06-28-2008, 02:52 PM
rumahweb rumahweb is offline
View Beta Profile
Junior Guru Wannabe
 
Join Date: May 2005
Location: Indonesia
Posts: 35
PHP I guess. When I debug on core.* file, I see that PHP script hits the RLIMIT.

__________________
Best Web Hosting in Indonesia
http://www.rumahweb.com

Reply With Quote
Sponsored Links
  #4  
Old 06-28-2008, 03:12 PM
johnny-l johnny-l is offline
View Beta Profile
Aspiring Evangelist
 
Join Date: May 2007
Location: italy
Posts: 393
Quote:
Originally Posted by rumahweb View Post
PHP I guess. When I debug on core.* file, I see that PHP script hits the RLIMIT.
So maybe you should patch/instruct PHP/Rlimit to not create core dumps, rather than focusing on apache.

PHP runs as the user (su-php), so maybe core dump limits should be set to zero for each user. I am not a debug expert, just throwing some wild guesses: good luck with your issue :-)

__________________
"I want" never gets ...

Reply With Quote
  #5  
Old 06-28-2008, 03:19 PM
rumahweb rumahweb is offline
View Beta Profile
Junior Guru Wannabe
 
Join Date: May 2005
Location: Indonesia
Posts: 35
Quote:
Originally Posted by johnny-l View Post
So maybe you should patch/instruct PHP/Rlimit to not create core dumps, rather than focusing on apache.
That's what I'm looking for. How disable coredump file generation

Quote:
Originally Posted by johnny-l View Post
PHP runs as the user (su-php), so maybe core dump limits should be set to zero for each user
I try to set it on /etc/security/limits.conf and ulimit -c 0,
but still - not worked

__________________
Best Web Hosting in Indonesia
http://www.rumahweb.com

Reply With Quote
  #6  
Old 06-28-2008, 03:28 PM
johnny-l johnny-l is offline
View Beta Profile
Aspiring Evangelist
 
Join Date: May 2007
Location: italy
Posts: 393
Quote:
Originally Posted by rumahweb View Post
That's what I'm looking for. How disable coredump file generation
Yep, but you were asking about "How to disable APACHE generating coredump" ... while I guess you should be patching rlimit/php.

__________________
"I want" never gets ...

Reply With Quote
  #7  
Old 06-28-2008, 04:04 PM
zacharooni zacharooni is offline
View Beta Profile
Premium Member
 
Join Date: Apr 2005
Location: Lansing, MI
Posts: 1,092
Did you already gdb backtrace the corefile?
Do this:

;Replace 89283 with the actual corefile name (most recent usually)
gdb -c core.89283
gdb> bt
;Look for the 'program', then:
gdb> q
gdb -c core.89283 /usr/bin/program
gdb> bt

Then paste out the #1 #2 #3 that you see here.

Reply With Quote
  #8  
Old 06-28-2008, 04:36 PM
rumahweb rumahweb is offline
View Beta Profile
Junior Guru Wannabe
 
Join Date: May 2005
Location: Indonesia
Posts: 35
Step #1
# gdb -c core.6341
GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Core was generated by `/usr/bin/php /home/pengki/public_html/resources.php'.
Program terminated with signal 24, CPU time limit exceeded.
#0 0x0000003ff0c0442b in ?? ()

Step #2
(gdb) bt
#0 0x0000003ff0c0442b in ?? ()
#1 0x00000000187937f8 in ?? ()
#2 0x00000000187937f0 in ?? ()
#3 0x00000000187937f8 in ?? ()
#4 0x00002b07b7bbfbb3 in ?? ()
#5 0x000000000063bde0 in ?? ()
#6 0x000000001879f3b0 in ?? ()
#7 0x000000000000045e in ?? ()
#8 0x000000003340485f in ?? ()
#9 0x0000000000000000 in ?? ()
(gdb) q

Step #3
#gdb -c core.6341 /usr/bin/php
GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

Reading symbols from /usr/lib64/libstdc++.so.6...done.
Loaded symbols for /usr/lib64/libstdc++.so.6
Reading symbols from /lib64/libcrypt.so.1...done.
Loaded symbols for /lib64/libcrypt.so.1
Reading symbols from /lib64/libssl.so.6...done.
Loaded symbols for /lib64/libssl.so.6
Reading symbols from /lib64/libcrypto.so.6...done.
Loaded symbols for /lib64/libcrypto.so.6
Reading symbols from /lib64/libpam.so.0...done.
Loaded symbols for /lib64/libpam.so.0
Reading symbols from /usr/lib64/libfreetype.so.6...done.
Loaded symbols for /usr/lib64/libfreetype.so.6
Reading symbols from /usr/lib64/libX11.so.6...done.
Loaded symbols for /usr/lib64/libX11.so.6
Reading symbols from /usr/lib64/libXpm.so.4...done.
Loaded symbols for /usr/lib64/libXpm.so.4
Reading symbols from /usr/lib64/libpng12.so.0...done.
Loaded symbols for /usr/lib64/libpng12.so.0
Reading symbols from /usr/lib64/libjpeg.so.62...done.
Loaded symbols for /usr/lib64/libjpeg.so.62
Reading symbols from /lib64/libresolv.so.2...done.
Loaded symbols for /lib64/libresolv.so.2
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libnsl.so.1...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /usr/lib64/libgssapi_krb5.so.2...done.
Loaded symbols for /usr/lib64/libgssapi_krb5.so.2
Reading symbols from /usr/lib64/libkrb5.so.3...done.
Loaded symbols for /usr/lib64/libkrb5.so.3
Reading symbols from /usr/lib64/libk5crypto.so.3...done.
Loaded symbols for /usr/lib64/libk5crypto.so.3
Reading symbols from /lib64/libcom_err.so.2...done.
Loaded symbols for /lib64/libcom_err.so.2
Reading symbols from /opt/curlssl/lib/libcurl.so.4...done.
Loaded symbols for /opt/curlssl//lib/libcurl.so.4
Reading symbols from /usr/lib64/libidn.so.11...done.
Loaded symbols for /usr/lib64/libidn.so.11
Reading symbols from /lib64/librt.so.1...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /usr/lib64/libmysqlclient.so.15...done.
Loaded symbols for /usr/lib64/libmysqlclient.so.15
Reading symbols from /opt/xml2/lib/libxml2.so.2...done.
Loaded symbols for /opt/xml2/lib/libxml2.so.2
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/libgcc_s.so.1...done.
Loaded symbols for /lib64/libgcc_s.so.1
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib64/libz.so.1...done.
Loaded symbols for /usr/lib64/libz.so.1
Reading symbols from /lib64/libaudit.so.0...done.
Loaded symbols for /lib64/libaudit.so.0
Reading symbols from /usr/lib64/libXau.so.6...done.
Loaded symbols for /usr/lib64/libXau.so.6
Reading symbols from /usr/lib64/libXdmcp.so.6...done.
Loaded symbols for /usr/lib64/libXdmcp.so.6
Reading symbols from /usr/lib64/libkrb5support.so.0...done.
Loaded symbols for /usr/lib64/libkrb5support.so.0
Reading symbols from /lib64/libkeyutils.so.1...done.
Loaded symbols for /lib64/libkeyutils.so.1
Reading symbols from /lib64/libpthread.so.0...done.
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libselinux.so.1...done.
Loaded symbols for /lib64/libselinux.so.1
Reading symbols from /lib64/libsepol.so.1...done.
Loaded symbols for /lib64/libsepol.so.1
Reading symbols from /usr/local/IonCube/ioncube_loader_lin_5.2.so...done.
Loaded symbols for /usr/local/IonCube/ioncube_loader_lin_5.2.so
Reading symbols from /usr/local/Zend/lib/ZendExtensionManager.so...done.
Loaded symbols for /usr/local/Zend/lib/ZendExtensionManager.so
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so...done.
Loaded symbols for /usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo.so...done.
Loaded symbols for /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo.so
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_sqlite.so...done.
Loaded symbols for /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_sqlite.so
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/sqlite.so...done.
Loaded symbols for /usr/local/lib/php/extensions/no-debug-non-zts-20060613/sqlite.so
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so...done.
Loaded symbols for /usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
Reading symbols from /usr/local/Zend/lib/Optimizer-3.3.3/php-5.2.x/ZendOptimizer.so...done.
Loaded symbols for /usr/local/Zend/lib/Optimizer-3.3.3/php-5.2.x/ZendOptimizer.so
Reading symbols from /lib64/libnss_dns.so.2...done.
Loaded symbols for /lib64/libnss_dns.so.2
Core was generated by `/usr/bin/php /home/pengki/public_html/resources.php'.
Program terminated with signal 24, CPU time limit exceeded.
#0 0x0000003ff0c0442b in clock_gettime () from /lib64/librt.so.1

__________________
Best Web Hosting in Indonesia
http://www.rumahweb.com

Reply With Quote
  #9  
Old 06-28-2008, 04:46 PM
zacharooni zacharooni is offline
View Beta Profile
Premium Member
 
Join Date: Apr 2005
Location: Lansing, MI
Posts: 1,092
There you go right there:

Core was generated by `/usr/bin/php /home/pengki/public_html/resources.php'.
Program terminated with signal 24, CPU time limit exceeded.

Reply With Quote
  #10  
Old 06-28-2008, 05:19 PM
rumahweb rumahweb is offline
View Beta Profile
Junior Guru Wannabe
 
Join Date: May 2005
Location: Indonesia
Posts: 35
Yes, but how to make PHP/Apache to stop generating core dump files without removing Rlimit configuration?

My goal is to limit resource per vhost but I dont want core dump files to be created. Or at least I can make all core dump files on specfic folder rather than having them all over user's directory.

It can really eat up user's space very quickly especialy for user who have a "high load" type script.

__________________
Best Web Hosting in Indonesia
http://www.rumahweb.com

Reply With Quote
  #11  
Old 06-28-2008, 05:39 PM
zacharooni zacharooni is offline
View Beta Profile
Premium Member
 
Join Date: Apr 2005
Location: Lansing, MI
Posts: 1,092
You can disable coredumps in /etc/security/limits.conf, Just add this line to the end:

* hard core 0

Reply With Quote
  #12  
Old 06-29-2008, 12:21 AM
rumahweb rumahweb is offline
View Beta Profile
Junior Guru Wannabe
 
Join Date: May 2005
Location: Indonesia
Posts: 35
I have try :
- set "ulimit -c 0" on users and root
- set "/proc/sys/fs/suid_dumpable" to 0
- set /etc/security/limits.conf with 0 limit for core parameter
- set CoreDumpDirectory to specific directory

Nothing works to stop apache from generating coredump files

__________________
Best Web Hosting in Indonesia
http://www.rumahweb.com

Reply With Quote
  #13  
Old 06-30-2008, 04:59 PM
rumahweb rumahweb is offline
View Beta Profile
Junior Guru Wannabe
 
Join Date: May 2005
Location: Indonesia
Posts: 35

I found a simple stupid solution. I hope it can help if you have same problem :

I add ulimit -c 0 on /etc/init.d/httpd below other ulimit setting.

No more apache coredump generated

__________________
Best Web Hosting in Indonesia
http://www.rumahweb.com

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement: