LinuxQuestions.org
Help answer threads with 0 replies.
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-25-2011, 08:10 AM   #1
MichaelGMorgan
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Rep: Reputation: 0
MySQL keeps crashing - Don't know why


Hello,
I'm currently running LAMP on an Amazon instance. The OS is from the Amazon 64 bit image.

Basically, every so often MySQL seems to go down. All of my sites fail to connect to their databases. I then have to SSH in and restart mysqld.

Heres the last 30 lines of /var/log/mysqld.log

Quote:
110225 13:35:33 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110225 13:35:33 InnoDB: Started; log sequence number 0 38288352
110225 13:35:33 [Note] Event Scheduler: Loaded 0 events
110225 13:35:33 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.47' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
110225 13:36:01 mysqld_safe Number of processes running now: 0
110225 13:36:01 mysqld_safe mysqld restarted
InnoDB: Error: pthread_create returned 11
110225 13:36:02 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
110225 13:36:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110225 13:36:39 InnoDB: Started; log sequence number 0 38288352
110225 13:36:39 [Note] Event Scheduler: Loaded 0 events
110225 13:36:39 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.47' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
110225 13:54:16 mysqld_safe Number of processes running now: 0
110225 13:54:16 mysqld_safe mysqld restarted
InnoDB: Error: pthread_create returned 11
110225 13:54:16 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
110225 13:54:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110225 13:54:53 InnoDB: Started; log sequence number 0 38288352
110225 13:54:53 [Note] Event Scheduler: Loaded 0 events
110225 13:54:53 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.47' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
110225 14:00:01 mysqld_safe Number of processes running now: 0
110225 14:00:15 mysqld_safe mysqld restarted
110225 14:00:40 InnoDB: Started; log sequence number 0 38288352
110225 14:00:44 [Note] Event Scheduler: Loaded 0 events
110225 14:00:44 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.47' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
110225 14:00:47 mysqld_safe A mysqld process already exists
I've removed mysql and mysql-server using 'yum remove' and then reinstalled it but the same is happening. I don't know what to try next.

Thanks!
 
Old 02-25-2011, 08:35 AM   #2
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
Quote:
Code:
InnoDB: Error: pthread_create returned 11
110225 13:36:02 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Someone suggest disable SELinux. Give it a try and let me know if it work.

Last edited by quanta; 02-25-2011 at 08:40 AM.
 
Old 02-25-2011, 01:04 PM   #3
MichaelGMorgan
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: 0
Surely SELinux needs to remain in place? This system was created from the exact same image as another system (so they're identical in terms of configuration). The other system works fine but handles a much lower load. Do you think this could be caused by running out of memory? How can I check this?

Thanks

Last edited by MichaelGMorgan; 02-25-2011 at 01:13 PM.
 
Old 02-25-2011, 11:21 PM   #4
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
As my understand, the above error seems that MySQL cannot create enough threads at startup. Did you take a look at /var/log/messages to see if it has anything relate to mysqld?

I suggest you start MySQL in debug mode for more details: http://forge.mysql.com/wiki/How_to_R...ith_a_Debugger
 
Old 02-26-2011, 06:32 AM   #5
markseger
Member
 
Registered: Jul 2003
Posts: 244

Rep: Reputation: 26
I would start by running collectl on the box. When mySQL crashes, go back and plot the collectl data to see which resource was getting starved. If nothing jumps out, drop the monitoring interval to 1 second and try again. There's often a clue in the data somewhere if it's a system/resource problem.
-mark
 
Old 02-26-2011, 06:44 AM   #6
MichaelGMorgan
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: 0
Ahh yes, it's a memory issue. Looking at that I can see that several mysqld and httpd processes have been killed off.

When I run 'top' I can see that most of the swap figures are at 0. 0k total, 0k used, 0k free, 24000k cached
I'm not great at this, but should I be seeing some figures here? I mean, once memory gets used up doesn't it try using pagefiles?

Is there a way that I can prevent the processes from being killed off other than upgrading the memory?
Thanks!
 
Old 02-26-2011, 03:51 PM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
I guess you need to increase the stack size. Run
Code:
ulimit -s
to find its actual size (usually it's 8192k)and use
Code:
ulimit -s xxxx
in order increase it

Regards
 
Old 03-02-2011, 04:35 AM   #8
MichaelGMorgan
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: 0
I've got around this with some optimization. I've removed a load of services I don't actually need. I've optimized both httpd and mysqld to be more efficient. It's been running smoothly for a few days now and memory usage is much lower than what it used to be

Thanks for all your help!
 
  


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
urgent help: mysql is crashing my server!!! steve51184 Linux - Server 6 08-01-2009 12:56 PM
MySQL permission or crashing problem?? patrickg28 Linux - Server 3 07-14-2009 01:37 PM
urgent help: mysql is crashing my server!!! steve51184 Linux - Server 18 03-05-2009 08:55 PM
MySQL: Table always crashing (error 134) Swakoo Linux - General 10 10-17-2008 01:16 PM
[crashing] mysql problem connection linux!! modpriest Linux - Newbie 1 08-29-2008 01:03 AM

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

All times are GMT -5. The time now is 12:12 PM.

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