2009-02-26 16:38 解决 Lost connection to MySQL server during quer

这两天遇Lost connection to MySQL server during query问题

现象:远程连接时出现连接丢失。同时mysql 错误日志抛出:
Number of processes running now: 0
090212 13:59:47 mysqld restarted
090212 13:59:47 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090212 13:59:47 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
090212 13:59:47 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...
090212 13:59:47 InnoDB: Started; log sequence number 0 61757
090212 13:59:47 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.75-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution
090212 15:09:21 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=402653184
read_buffer_size=2097152
max_used_connections=2
max_connections=1000
threads_connected=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 294912 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0xa21a308
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbe3ff368, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x80de0ec
0x83a431c
0x78e9e8
0x77d60f
0x77d6cd
0xbad265
0xbae344
0x83d11e9
0x83d1046
0x80e5496
0x81033f7
0x839ec55
0x83cee1a
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/using-stack-trace.html and follow instructions on how to resolve the stack trace. Reso
lved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at (nil) is invalid pointer
thd->thread_id=3
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

You are running a statically-linked LinuxThreads binary on an NPTL system.
This can result in crashes on some distributions due to LT/NPTL conflicts.
You should either build a dynamically-linked binary, or force LinuxThreads
to be used with the LD_ASSUME_KERNEL environment variable. Please consult
the documentation for your distribution on how to do that.

分析:以往都是动态编译线程。不同的是这次采用了linuxthread静态编译。
# cd cd /var/tmp/mysql-5.0.75/
# CFLAGS="-O3 -mcpu=pentium4" CXX=gcc CXXFLAGS="-O3 -march=pentium4 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql \
--without-debug \
--with-charset=gb2312 \
--with-extra-charsets=all \
--with-pthread \
--enable-assembler \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \

每次出现lost connection时,日志就抛出一次 mysqld restarted !

应该跟线程库有关。

AS4U6 带有两种线程库 NTPL LinuxThread (NGPT已经停止开发)。默认是使用NTPL。 编译时采用哪种都可以,但不能有冲突。

解决的关键就是

想要使用不同的线程库,就使用 LD_ASSUME_KERNEL 这个变量来切换或自己定义。

先判断系统使用的库的版本

shell> eu-readelf -n /lib/libc.so.6
Note segment of 32 bytes at offset 0x154:
Owner          Data size Type
GNU                   16 VERSION
    OS: Linux, ABI: 2.2.5

shell> export LD_ASSUME_KERNEL=2.2.5
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
这样就解决了。

把export LD_ASSUME_KERNEL=2.2.5 加入到 mysqld_safe 中,启动时会自动设置这个变量。

另一种解决方法
就是编译时 去掉--with-mysqld-ldflags=-all-static 。

 

转自http://hi.baidu.com/chinaw3/item/5bf9aced6dd7c10e560f1d37

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值