LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-23-2008, 11:16 AM   #1
fmillion
Member
 
Registered: Nov 2006
Posts: 93

Rep: Reputation: 27
processes randomly dying on my server


Hi,
I've just started experiencing a weird problem with my linux server. Randomly processes will just die with the message "Killed" printed to standard output, as if someone issued a kill sigterm on them. While the machine does not have a *lot* of memory, the "free" report does show available memory outside of swap. Specifically, mysqld and asterisk are the two servers that seem to be crashing a lot. Both are latest versions. The server is a Pentium 3 with 256MB of RAM and plenty of swap allocated. With mysql, mysqld_safe seems to be doing its job of restarting mysqld when it dies, but there's still no indication in any log files or anything that would tel me exactly why these processes are just dying. Asterisk just, isn't there suddenly. I have to manually restart it. I was going to write a script that puts it in a loop to make sure it stays running, but I would really like to know exactly why these processes are being killed. I could add more RAM to the system if it would help. however I'm trying to understand why it would be necessary:

fmillion@millions:~$ free
total used free shared buffers cached
Mem: 253460 237320 16140 0 54608 95840
-/+ buffers/cache: 96872 156588
Swap: 615524 188896 426628

./mysqld_safe: line 368: 22752 Killed nohup /home/mysql/libexec/mysqld --basedir=/home/mysql --datadir=/home/mysql/var --user=mysql --pid-file=/home/mysql/var/millions.pid --skip-external-locking --port=3306 --socket=/var/run/mysql/mysql.sock >>/home/mysql/var/millions.err 2>&1
Number of processes running now: 0
080222 00:09:04 mysqld restarted

-- Hungup 'Zap/1-1'
*CLI> Killed
root@millions:#

That's pretty much what I get...

Flint M
 
Old 02-23-2008, 11:32 AM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
I do not know all the rules governing this, but I do know that the kernel will kill processes that are running away, or sucking resources, or doing something not allowed, or interfering with the kernel itself.

I have seen it myself under one circumstance. I have found that there is a memory leak in some combination of X, compiz, and firefox such that after running a session for a week or so I sometimes have full RAM, nearly full swap, and a sluggish system. I then restart X to clear things out. This leaves a lot of swap in use, and I then issue a swapoff -a to force all that swapped data back into RAM.

It can sometimes happen that I run out of RAM before swap is emptied. In this event, the system appears to hang for several minutes, then the kernel kills my swapoff command (giving the message killed, just as you have reported) and resumes operating normally, with swap re-enabled.

So the kernel will do this. Why is it doing it to you? I have no clue.
 
Old 02-24-2008, 07:05 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Have you looked at /var/log/messages (and the /var area in general for asterisk, mysql)?
 
Old 02-25-2008, 11:55 PM   #4
fmillion
Member
 
Registered: Nov 2006
Posts: 93

Original Poster
Rep: Reputation: 27
ok so I found out it is indeed a memory problem; the mysql process apparently goes haywire and starts getting in a memory loop. I finally directly observed the server in its anguish as both the 1GB of swap and the RAM got completely used up and the kernel killed mysqld processes to rescue itself. Guessing it's a MySQL bug (4.1.22) - have to check if there's more updates for the 4.x series.
 
Old 02-26-2008, 04:35 PM   #5
LongPig_Yum
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Rep: Reputation: 0
Set up a cron job to run every minute or 2 that runs top in batch mode and sends the output to a file.
Or use ps . This way you will have a record of what processes are doing what.
Also use sar eg: sar -qrwW

top-mon:

#!/bin/sh

DATE=`date +%a" "%D" "%T `

echo "" >>/var/log/top-out
echo "" >>/var/log/top-out
echo $DATE >>/var/log/top-out
echo "" >>/var/log/top-out

/usr/bin/top -n 1 -b -c >>/var/log/top-out &
 
Old 02-26-2008, 04:44 PM   #6
jonesr
Member
 
Registered: Feb 2008
Location: Sacramento
Distribution: RHEL AS, mostly
Posts: 44

Rep: Reputation: 18
It's the "OOM killer"

Use your favorite search engine to look for information about the "OOM killer".

Unfortunately, while they're the last ones you want killed, database engines tend to exhibit exactly the behavior the OOM killer looks for.
 
Old 02-27-2008, 10:18 AM   #7
p_s_shah
Member
 
Registered: Mar 2005
Location: India
Distribution: RHEL 3/4, Solaris 8/9/10, Fedora 4/8, Redhat Linux 9
Posts: 237
Blog Entries: 1

Rep: Reputation: 34
Check whether any mysql query is creating loop or what.
Enable mysql_slow_query_log and check time for executing Mysql Queries.

I didnt have the same problem, but due to some mysql queries, my server was getting slow. On checking, I found that one query was taking 30-40 seconds( which should be less than 1 second),
to execute. On checking table, I found there were millions of records, which was slowing the process.

Check if any such type of issues are there or not.

Regards,
 
Old 03-01-2008, 01:03 AM   #8
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by fmillion View Post
ok so I found out it is indeed a memory problem; the mysql process apparently goes haywire and starts getting in a memory loop. I finally directly observed the server in its anguish as both the 1GB of swap and the RAM got completely used up and the kernel killed mysqld processes to rescue itself. Guessing it's a MySQL bug (4.1.22) - have to check if there's more updates for the 4.x series.
As a patch, set up a cron job to run every minute or so to check for the presence of the mysql daemon. If it is gone, restart it.

Probably someone has a badly written query that is looping and sucking the life out of your system. This query runs as part of a daily batch update, which is why you only see it at night. Enable all logging and see if you can figure out what user is doing it, but in the meanwhile that cron that restarts the mysqld is your key to getting a full night of sleep.
 
Old 06-03-2008, 01:49 AM   #9
fmillion
Member
 
Registered: Nov 2006
Posts: 93

Original Poster
Rep: Reputation: 27
Hah, So it turns out the entire thing was because of Wiki spam!! I had a Mediawiki running on my server. The database was... ready for this.. 955MB of data! But I did upgrade to MySQL 5.0.51 anyway and now all seems to be good! Going to now do the research on how to lock down this Wiki - specifically, only let registered people post!

FM
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Just Goes Down Randomly Geminias Linux - Networking 7 03-16-2007 02:45 PM
X server dying at night, freezing during the day roastedmnm SUSE / openSUSE 1 02-28-2007 09:58 AM
computer dying randomly, can't figure out memtest results Artanicus Linux - Hardware 6 10-27-2005 08:14 PM
Problem with background processes dying when internet connection terminates TrulyTessa Linux - General 2 12-04-2004 10:45 PM
Troubleshoot dying processes hallamigo Mandriva 5 05-29-2004 03:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration