Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Dec 30, 2005 3:02 pm 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
Warning: mysql_connect(): Lost connection to MySQL server during query in /var/www/localhost/htdocs/xxx/xxx.php on line ##
Can not connect to the database. Lost connection to MySQL server during query


Top
   
 Post subject:
PostPosted: Fri Dec 30, 2005 4:33 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
Check your mysql log for segfaults. Also, which host are you on, what distribution are you running, and which kernel?

-Chris


Top
   
 Post subject:
PostPosted: Sat Dec 31, 2005 8:14 pm 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
Thanks for the quick reply

I am on host45.linode.com
running Getnoo Kernel 2.4.29-linode39-1um

my mysql.log is empty wich probably means I never turned it on. I will have to read up and try to turn it on.

Here is what mysql.err shows

Number of processes running now: 1
mysqld process hanging, pid 4682 - killed
051229 10:30:42 mysqld restarted

Number of processes running now: 1
mysqld process hanging, pid 22519 - killed
051230 12:34:00 mysqld restarted
051230 12:34:04 mysqld ended

051230 13:50:00 mysqld started

Number of processes running now: 1
mysqld process hanging, pid 1255 - killed
mysqld restarted

Number of processes running now: 1
mysqld process hanging, pid 1780 - killed
051230 13:51:32 mysqld restarted

Number of processes running now: 1
mysqld process hanging, pid 1816 - killed
051230 13:54:17 mysqld restarted


Top
   
 Post subject:
PostPosted: Sat Dec 31, 2005 8:33 pm 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
I got it to log but now I cant replicate the error. I am sure I will see it again soon it is a common occurrence. I will make sure to post as soon as I see it.


Top
   
 Post subject:
PostPosted: Sun Jan 01, 2006 2:32 pm 
Offline
Senior Newbie

Joined: Sun Aug 07, 2005 4:48 pm
Posts: 6
Hi,

I noticed the same problem with mysql. I am also on host45, with gentoo but with a 2.6 kernel. Basically, mysqld crashes randomly, normally mysqld then restarts automatically, but not all the time, and then my web site cannot work anymore, I have to restart mysql manually.

I tried to upgrade mysql from 4.0.25 to 4.1.14, but it didn't change anything ...

On a side note, I noticed another weird thing : last time I rebooted my linode (few days ago), one of my service (spamd) did a segfault on startup, so I had to start it manually.

What's happening is similar to what Fifo reports, I get that kind of log in /var/log/mysql/mysql.err :

Number of processes running now: 1
mysqld process hanging, pid 18585 - killed
060101 08:21:03 mysqld restarted


and then in /var/log/mysql/mysqld.err :

060101 8:21:05 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
060101 8:21:06 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 43784.
InnoDB: Doing recovery: scanned up to log sequence number 0 43784
InnoDB: Last MySQL binlog file position 0 79, file name ./zlinode-bin.000007
060101 8:21:06 InnoDB: Flushing modified pages from the buffer pool...
060101 8:21:06 InnoDB: Started; log sequence number 0 43784
/usr/sbin/mysqld: ready for connections.
Version: '4.1.14-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Gentoo Linux mysql-
4.1.14


Top
   
 Post subject:
PostPosted: Thu Jan 05, 2006 7:15 pm 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
I just got the same error Nothing funny in the mysql.log file

the mysql.err continues to display the following everytuime this happens.


Number of processes running now: 1
mysqld process hanging, pid 1181 - killed
060105 17:52:49 mysqld restarted


here is mysqld.err

060105 17:53:04 InnoDB: Started
/usr/sbin/mysqld: ready for connections.
Version: '4.0.25-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Gentoo Linux mysql-4.0.25-r2


Top
   
 Post subject:
PostPosted: Sat Jan 07, 2006 12:42 pm 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
Here is what I get when the server locks up and I could do absoultely nothing but restart the server for it to come back up. The logs still show nothing different from what is already above.

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /var/www/localhost/htdocs/xxxx.php on line 17
Can not connect to the database. Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


Top
   
 Post subject:
PostPosted: Mon Jan 09, 2006 9:07 am 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
This Problem keeps occurring. This morning it locked up the server and I couldnt access anything. The only thing that fixes it is a reboot. Anything I can try?


Top
   
 Post subject:
PostPosted: Mon Jan 09, 2006 2:53 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
fifo wrote:
This Problem keeps occurring. This morning it locked up the server and I couldnt access anything. The only thing that fixes it is a reboot. Anything I can try?


Locking up the Linode sounds like you might have been swap thrashing, or hit the IO-Limiter. Check /proc/swaps and /proc/io_status.

I'd give the mysql binary install from mysql.com a try. Also:

http://www.linode.com/forums/viewtopic.php?p=4810#4810

-Chris


Top
   
 Post subject:
PostPosted: Mon Jan 09, 2006 8:01 pm 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
here is my /proc/swap im not sure if this is what should be in here

Filename Type Size Used Priority
/dev/ubd/1 partition 263160 0 -1

here is the io_status
io_count=57000 io_rate=0 io_tokens=400000 token_refill=512 token_max=400000

I will have to give the mysql binary a try


Top
   
 Post subject:
PostPosted: Tue Jan 10, 2006 11:16 am 
Offline
Senior Newbie

Joined: Sun Aug 07, 2005 4:48 pm
Posts: 6
Thanks for pointing us to this other thread. I tried as they suggest to set the thread_cache_size variable to 40 in my.cnf, I'll see if it improves things, but I suspect it is a workaround rather than a real fix (since people report occasional crashes even with that)

One thing is that I didn't update my fundamental packages (like glibc and gcc) since this summer, so maybe it is a bug in glibc or another library that mysql depends on and that has been fixed since then. How old is your glibc, fifo ? Mine is at version 2.3.5-r1, and gcc is 3.3.5.20050130-r1, I'm about to upgrade to latest versions and see if it improved things ...

What make me think that it may be a glibc problem is that I have another weird problem with a completely different tool, that is ImageMagick. Images converted and resized with it sometimes get garbages in them, altough the same version of ImageMagick on my local computer doesn't introduce these garbages. What's really weird is that these garbages appear each time at new random places but only on certain photos and always on these same photos, and the original photos on the server are perfectly intact. It's like if certain sequence of bytes in a file trigger some kind of stack overflow or anything that later on make the program behave in an unpredictable way.

I also tried to use NetPBM instead of ImageMagick, but this time I get garbages as well but on DIFFERENT photos.

I don't think these are bugs in these software because these are quite mature packages, beside I've never had any problems with them on my own local computer.

All this lead my to thing that there's something very fondamental that is unreliable. I hope it's just a bad glibc version.

About swap trashing, it's very unlikely because the traffic of my site is very low most of the time. I almost never use swap (I'm on a linode 160)


UPDATE : so I set that variable thread_cache_size to 80 (not 40 as I said above) in my.cnf and updated glibc to 2.3.5-r2, and since then the problem hasn't shown up (in about 24 hours) To set the variable in /etc/mysql/my.cnf, you have to add that line in the [mysqld] section

set-variable = thread_cache_size=80


However , I still have problems with ImageMagick and NetPBM, I'll try to recompile them (since I updated gcc too)


Top
   
 Post subject:
PostPosted: Fri Jan 20, 2006 12:14 am 
Offline
Senior Member

Joined: Thu Sep 29, 2005 9:52 pm
Posts: 79
Website: http://www.hectorg.net
Location: Miami, Florida
It has been about a week since I modified my.cnf and added thread_cache_size variable = 40. I have not gotten the error any more but it may be too soon to say. Thanks for the help to all that replied. I never got around to installing the binaries I figured I would try the quick and dirty and it seemed to work. If I get any more errors I guess I will be back. Thanks again


Top
   
 Post subject:
PostPosted: Mon Jan 23, 2006 4:54 am 
Offline
Senior Newbie

Joined: Sun Aug 07, 2005 4:48 pm
Posts: 6
For almost two weeks the problem almost completely disapeared (I stil had occasional connection problems to the mysql database but it would resolve itself without having to restart mysqld)

But since early this morning (midnight in France) it started again to behave wrongly exactly like two weeks ago before I changed the thread_cache_size variable.

Now I have a script that automatically restarts mysqld when it happens, but it's still very annoying especially because each time databases need to be repaired after mysqld has crashed.


Top
   
 Post subject:
PostPosted: Sat Jan 28, 2006 4:01 am 
Offline
Senior Member

Joined: Sat Jun 05, 2004 12:49 am
Posts: 333
dont use mysql, it has a nasty habit of seriously thrasing things when it goes down in flames.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group