`
beck1986
  • 浏览: 28516 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论
阅读更多

 
Login / Register
Developer ZoneBugs HomeReport a bugStatisticsAdvanced searchSaved searchesTags

Bug #44841 MySQL hanged on long semaphore wait (X-lock on RW-latch)
Submitted: 13 May 2009 11:39 Modified: 8 Sep 2009 23:02
Reporter: Nickolay Vinogradov 
Status: Open 
Category: Server: InnoDB Severity: S2 (Serious)
Version: 5.1.34-0 OS: Linux (SUSE Linux Enterprise Server 10 SP2 (x86_64))
Assigned to:  Target Version: 
Tags: X-lock, RW-latch dict0dict.c 

ViewAdd CommentFilesDeveloperEdit SubmissionView Progress Log

[13 May 2009 11:39] Nickolay Vinogradov
Description:
Every few days MySQL hanged with the same warnings:

InnoDB: Warning: a long semaphore wait:
--Thread 1173395776 has waited at row/row0mysql.c line 1720 for 241.00 seconds the
semaphore:
X-lock on RW-latch at 0xc73b20 created in file dict/dict0dict.c line 728
a writer (thread id 1173395776) has reserved it in mode  wait exclusive
number of readers 1, waiters flag 1
Last time read locked in file row/row0mysql.c line 1685
Last time write locked in file row/row0mysql.c line 1720
InnoDB: ###### Starts InnoDB Monitor for 30 secs to print diagnostic info:
InnoDB: Pending preads 0, pwrites 0

Every time thread waited at "row/row0mysql.c line 1720" or at "row/row0mysql.c line
1685", and every time "S-lock" or "X-lock" on RW-latch at 0xc73b20 created in file
dict/dict0dict.c line 728.

How to repeat:
MySQL running under high load.
Uptime: 5322  Threads: 454  Questions: 11475628  Slow queries: 19839  Opens: 1342  Flush
tables: 1  Open tables: 1335  Queries per second avg: 2156.262
All tables are InnoDB.[13 May 2009 11:40] Nickolay Vinogradov
MySQL installed from MySQL-server-community-5.1.34-0.sles10.x86_64.rpm[13 May 2009 11:45] Nickolay Vinogradov
InnoDB Monitor OutputAttachment: innodb_monitor_output.log (application/octet-stream, text), 117.05 KiB.[13 May 2009 12:19] Valeriy Kravchuk
Please, send your my.cnf file content and the results of:

df -k

Here we have purge thread in conflict the thread doing rollback of:

INSERT INTO nagios_hoststatus SET instance_id='1', host_object_id='1',
status_update_time=FROM_UNIXTIME(1242201087), ...

Please, send the results of SHOW CREATE TABLE and SHOW TABLE STATUS for this
nagios_hoststatus table also.[13 May 2009 14:29] Nickolay Vinogradov
my.cnfAttachment: my.cnf (application/octet-stream, text), 20.56 KiB.[13 May 2009 14:30] Nickolay Vinogradov
nickolay@new_db:~> df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             10490040   6880800   3609240  66% /
udev                   8220496       104   8220392   1% /dev
/tmpfs                 1048576         8   1048568   1% /tmpfs
/dev/sda2            419267584 219350508 199917076  53% /mysql[13 May 2009 14:36] Nickolay Vinogradov
mysql> SHOW TABLE STATUS WHERE name LIKE 'nagios_hoststatus';
+-------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-------------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------------------------------+
| Name              | Engine | Version | Row_format | Rows | Avg_row_length | Data_length
| Max_data_length | Index_length | Data_free   | Auto_increment | Create_time         |
Update_time | Check_time | Collation       | Checksum | Create_options | Comment        
               |
+-------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-------------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------------------------------+
| nagios_hoststatus | InnoDB |      10 | Compact    |    8 |           2048 |       16384
|               0 |        16384 | 22985834496 |         566410 | 2009-03-02 22:53:47 |
NULL        | NULL       | utf8_general_ci |     NULL |                | Current host
status information |
+-------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-------------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------------------------------+[13 May 2009 16:34] Nickolay Vinogradov
Warning and InnoDB Monitor Output(Previous Hang)Attachment: innodb_monitor_output2.log (text/x-log), 140.53 KiB.[13 May 2009 16:39] Nickolay Vinogradov
Valeriy, please look at last attached file. It's from previous hang.
If I understand correctly, now the problem with thread doing rollback of:

INSERT INTO nagios_programstatus SET instance_id='1',
status_update_time=FROM_UNIXTIME(1241899442)...[13 May 2009 17:13] Valeriy Kravchuk
OK, so this is not related to particular table (do you know what is the reason for
rollback, by the way?), but more to transaction rate maybe.

Can you, please, try to set innodb_max_purge_lag = 1000000, for example, and check if it
will influence the rate of hangs related to purge vs rollback activity. You can set it
dynamically, with SET GLOBAL. Read
http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html#sysvar_innodb_max_purge_lag
for the details.

Side note: I had noted memlock in your my.cnf. Please, send the results of:

free

Linux command.[13 May 2009 17:27] Nickolay Vinogradov
new_db:/home/nickolay # free
             total       used       free     shared    buffers     cached
Mem:      16440996   16346032      94964          0      99936    1825508
-/+ buffers/cache:   14420588    2020408[13 May 2009 17:43] Valeriy Kravchuk
Not that much of free memory left. Can you try also to remove memlock option and check if
this will influence the situation in any way?[18 May 2009 19:08] Nickolay Vinogradov
MySQL hanged again.
But now without "long semaphore error".
Let me to upload innodb monitor output.[18 May 2009 19:10] Nickolay Vinogradov
Innodb monitor outputAttachment: innodb_monitor_output3.txt (text/plain), 62.52 KiB.[7 Jun 2009 21:58] Nickolay Vinogradov
Problem repeated again and again even after we replace hardware.
We are delete memlock, and add innodb_max_purge_lag = 1000000, but it isn't help.
Any idea?[7 Jun 2009 22:00] Nickolay Vinogradov
Last innodb monitor outputAttachment: innodb.out.333 (application/octet-stream, text), 62.52 KiB.[30 Jun 2009 19:56] Valeriy Kravchuk
Bug #45813 was marked as a duplicate of this one. It contains newer error log and shows
that we get assertion failure eventually as a result of a long wait.[30 Jun 2009 20:01] Nickolay Vinogradov
I have increase innodb_max_purge_lag to 10000000, and decrease innodb_thread_concurrency
from 32 to 16. And problem has occured today.

Valeriy, do you think is the problem with thread concurrency?[30 Jun 2009 21:04] Nickolay Vinogradov
Problem happens again!
Even after I have decreased innodb_thread_concurrency to 8.

Valeriy, How are you going to fix this problem?[8 Sep 2009 22:32] James Day
Nickolay, it's just a symptom of heavy load. It's one of the ways that extreme heavy
disk-bound load shows up. In this case the main symptom is the data dictionary operations
that involve waiting for disk I/O.dict/dict0dict.c and row/row0mysql.c are those. InnoDB
doesn't expect to wait hundreds of seconds for disk I/O so when it does the watchdog
process notices and starts printing diagnostic output. Sometimes the wait gets so long
that it concludes that InnoDB must be hung and restarts the server.

The most common way to encounter data dictionary operations is creating and deleting
temporary tables but renaming and some other operations can also take the global data
dictionary mutex.

One way a thread can be waiting for itself is if it takes a lock and then another thread
takes a lock. If it then accesses the row again it's possible that the order of requests
in the list of threads waiting for locks can cause it to block on itself. It's rare and
not easy to fix so it probably won't be fixed in 5.1. In your case it's probably just
normal locking and high load, not this bug.

The purge thread is known to cause performance pain when it's busy. That's for two
reasons:

1. It uses a lot of disk I/O.
2. innodb_max_purge_lag is usually not set, so it can grow larger than can be cached in
the buffer pool and become even more disk-bound.

Setting innodb_max_purge_lag to a smaller value, perhaps 100,000, might help to give the
purge thread more of a chance to keep up.

Look at performance tuning and you should be able to solve the problem. You could also
try the 5.4 preview release. That has additional tuning settings and some improved
default capabilities that improve throughput. It's not officially released for production
use yet but those people who do use it tend to have good results.

James Day, MySQL Senior Support Engineer, Sun Microsystems, England.[8 Sep 2009 23:02] Nickolay Vinogradov
Hello James,
The problem resolved after downgrading to MySQL 5.0.x.© 1995-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
Privacy PolicyContact Us

Portions of this website are copyright © 2001, 2002 The PHP Group.
Page generated in 0.126 sec. using MySQL 5.1.30-log



Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.
分享到:
评论

相关推荐

    MySQL Crash Course 原版CHM

    "MySQL Crash Course"是一本专为快速掌握MySQL核心概念和技术设计的教程,旨在帮助初学者和有一定基础的学习者迅速提升MySQL技能。 这本书的原版CHM格式提供了方便的电子阅读体验,CHM(Compiled HTML Help)是一种...

    mysql必知必会 MySQL.Crash.Course

    《MySQL必知必会》是数据库领域中一本非常经典的教程,尤其对于初学者而言,它提供了全面而实用的MySQL知识。MySQL是一种广泛使用的开源关系型数据库管理系统(RDBMS),在Web应用程序中扮演着核心角色。这本书以...

    基于docker搭建的《MySQL Crash Course》学习实操环境.zip

    基于docker搭建的《MySQL Crash Course》学习实操环境

    mysql crash course

    2. **数据库和表**:在MySQL中,数据库是存储数据的逻辑容器,而表是数据的结构化布局。创建数据库和表需要掌握CREATE DATABASE和CREATE TABLE语句,同时理解主键(Primary Key)、外键(Foreign Key)等概念。 3. ...

    (Safari Books Online_Sams Teach Yourself in 10 Minutes) Forta, Ben - MySQL crash course Includes index-Sams Publishing (2005).pdf

    《MySQL Crash Course》是Ben Forta撰写的一本关于MySQL快速学习的书籍,由Sams Publishing在2005年出版。这本书旨在帮助读者在短时间内掌握MySQL数据库系统的基础知识和核心概念,适合初学者和需要快速了解MySQL的...

    MySQL实例crash的案例详细分析

    在本案例中,我们面临的是一个关于MySQL实例崩溃的问题,主要涉及MySQL 5.6.21版本。问题描述指出,生产环境中有多台MySQL服务器不定期地崩溃,但错误日志(error log)并未记录崩溃时的堆栈信息,只显示了重启过程。...

    Sams.MySQL.Crash.Course.Dec.2005.chm

    Sams.MySQL.Crash.Course.Dec.2005.chm

    03_MySQL 5.7 基于GTID的并行MTS多级主从 Multisource Crash safe半同步架构1

    2. **并行MTS(Multi-Threaded Slave)**: MTS 是 MySQL 中的一个特性,允许从库上的多个线程并发处理主库来的不同GTID组的事务,提高了数据复制的效率。在并行MTS中,从库会根据GTID将事务分配给不同的工作线程,...

    MariaDB Crash Course (MySQL速成)

    标题《MariaDB Crash Course (MySQL速成)》和描述表明这是一本专门为初学者编写的关于MariaDB的使用指南,同时也适用于希望快速掌握MySQL数据库技术的读者。本书强调的是其易于理解的条理性和入门级的适用性。标签...

    Apache, MySQL, and PHP Weekend Crash Course.PDF

    Apache, MySQL, and PHP Weekend Crash Course.PDF

    05_数据库代理——企业博客MySQL 5.7 基于GTID的并行MTS多级主从 Multisource Crash safe半

    本文将探讨一种针对企业博客的MySQL 5.7数据库架构,该架构利用Global Transaction Identifier (GTID) 和 Multi-source Replication (MTS) 实现多级主从复制,并结合Crash safe策略确保数据一致性与高可用性。...

    2024中国MySQL生态年会(公开)PPT合集(11份).zip

    6、Making MySQL XA transactionprocessing crash safe 7、面向云原生架构的数据库引擎 8、云计算成本优化-大数据降本增效实战 9、瑞幸咖啡数据库平台与架构实践 10、MySQL HeatWave Lakehouse 11、分布式数据库必须...

    mysql必知必会脚本

    "crashcourse"通常指的是快速学习课程,这个标签暗示了这是一个旨在短时间内快速掌握MySQL核心概念的教程。在描述中提到,原版的crashcourse脚本可能无法直接运行,因此进行了修改和补充,这意味着这个压缩包中的...

    MySQL 速成课程,第二版

    MySQL Crash Course, 2nd Edition 检索和排序数据 使用比较、正则表达式、全文搜索等过滤数据 连接关系数据 创建和更改表 插入、更新和删除数据 利用存储过程和触发器的强大功能 使用视图和游标 管理事务处理 创建...

    MySQL必知必会 的配套源码

    这本书的英文原版名为《MySQL Crash Course》,通过一系列实践性的例子和练习,让学习者能够深入理解数据库管理和SQL查询。配套源码包括了`populate.sql`和`create.sql`两个文件,它们在书中扮演着关键角色,用于...

    MySQL数据库入门学习资源

    `mysql crash course script (chapter03-17)` 和 `mysql crash course script (chapter18-29)` 文件名暗示了它们是书中各章节的配套练习或示例脚本。这些SQL脚本可能是书中的练习解决方案,帮助读者实践和巩固书...

    2024 中国MySQL生态年会(11份PPT下载).zip

    6、Making MySQL XA transactionprocessing crash safe 7、面向云原生架构的数据库引擎 8、云计算成本优化-大数据降本增效实战 9、瑞幸咖啡数据库平台与架构实践 10、MySQL HeatWave Lakehouse 11、分布式数据库必须...

    MYSQL常见故障分析

    MySQL crash指的是数据库进程崩溃,这通常是由于数据库的Bug、硬件故障或内存不足等原因引起的。主机Hung指的是数据库所在的服务器响应缓慢或无响应,这时需要检查服务器整体状态和资源使用情况。 为了诊断MySQL...

    mysql 断电不能启动

    - **崩溃恢复启动**:“Starting crash recovery.”,MySQL尝试进行崩溃恢复。 - **表空间读取**:“Reading tablespace information from the .ibd files...”,系统正在扫描所有.ibd文件来获取表空间信息。 - *...

Global site tag (gtag.js) - Google Analytics