Skip to content

Instantly share code, notes, and snippets.

@y-ken
Created May 8, 2013 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save y-ken/5541075 to your computer and use it in GitHub Desktop.
Save y-ken/5541075 to your computer and use it in GitHub Desktop.
mroongaの動作が不安定になるタイミングとメモリ使用量に関係性がありそうです。

OOM-Killer発動タイミング

環境

$ cat /etc/redhat-release
CentOS release 6.4 (Final)

$ rpm -qa | grep -i -E "(oon|mecab|mysql)"|sort
groonga-libs-3.0.3-0.el6.x86_64
groonga-normalizer-mysql-1.0.3-0.el6.x86_64
groonga-tokenizer-mecab-3.0.3-0.el6.x86_64
mecab-0.995-1.el6.x86_64
mecab-devel-0.995-1.el6.x86_64
mecab-ipadic-2.7.0.20070801-6.el6.1.x86_64
MySQL-client-5.6.11-1.el6.x86_64
MySQL-devel-5.6.11-1.el6.x86_64
mysql-mroonga-3.03-1.el6.mysql56.x86_64
MySQL-server-5.6.11-1.el6.x86_64
MySQL-shared-5.6.11-1.el6.x86_64
MySQL-shared-compat-5.6.11-1.el6.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64

memory usage

/var/lib/mysql/groonga.log

2013-05-08 19:01:53.453555|n|6c14f700|DDL:obj_remove ****_search-data
2013-05-08 19:01:53.454689|n|6c14f700|DDL:obj_remove ****_search-data.index
2013-05-08 19:01:53.461450|n|6c14f700|DDL:obj_remove ****_search
2013-05-08 19:01:53.461712|n|6c14f700|DDL:obj_remove ****_search.data
2013-05-08 19:01:57.993542|n|8d96b720|mroonga 3.03 started.
2013-05-08 19:01:57.993562|n|8d96b720|log level is 'NOTICE'
2013-05-08 19:02:40.920455|n|8c0ee700|io(*****.mrn) collisions(1000/119): lock failed 1000 times
2013-05-08 19:09:49.293655|n|d8afe720|mroonga 3.03 started.
2013-05-08 19:09:49.293676|n|d8afe720|log level is 'NOTICE'
2013-05-08 19:10:01.010939|n|1d436700|io(*****.mrn) collisions(1000/119): lock failed 1000 times
2013-05-08 19:28:58.470488|n|1d436700|io(*****.mrn) collisions(1000000/119)

/var/log/messages

May  8 21:08:32 ***** kernel: Out of memory: Kill process 19269 (mysqld) score 829 or sacrifice child
May  8 21:08:32 ***** kernel: Killed process 19269, UID 494, (mysqld) total-vm:47069536kB, anon-rss:32121780kB, file-rss:16kB

/var/log/mysqld.log

2013-05-08 19:01:46 7f57b4d3a700 InnoDB: FTS Optimize Removing table ********/job_*****
10:01:53 UTC - 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=134217728
read_buffer_size=1048576
max_used_connections=1
max_threads=250
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1158452 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x457212f0
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...
stack_bottom = 7f626c14ee18 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x8c4655]
/usr/sbin/mysqld(handle_fatal_signal+0x4a4)[0x65c004]
/lib64/libpthread.so.0[0x3dd640f500]
/usr/lib64/libgroonga.so.0(+0x4e0bc)[0x7f626c95b0bc]
/usr/lib64/libgroonga.so.0(+0x4d7b5)[0x7f626c95a7b5]
/usr/lib64/libgroonga.so.0(+0x4df81)[0x7f626c95af81]
/usr/lib64/libgroonga.so.0(+0x4d843)[0x7f626c95a843]
/usr/lib64/libgroonga.so.0(grn_obj_remove+0xbb)[0x7f626c95b05b]
/usr/lib64/mysql/plugin/ha_mroonga.so(_ZN10ha_mroonga20storage_delete_tableEPKcP16st_mroonga_shareS
1_+0x160)[0x7f622f839460]
/usr/lib64/mysql/plugin/ha_mroonga.so(_ZN10ha_mroonga12delete_tableEPKc+0x31d)[0x7f622f845f0d]
/usr/sbin/mysqld(_Z15ha_delete_tableP3THDP10handlertonPKcS4_S4_b+0xbe)[0x5a6dae]
/usr/sbin/mysqld(_Z23mysql_rm_table_no_locksP3THDP10TABLE_LISTbbbb+0xd12)[0x722682]
/usr/sbin/mysqld(_Z11mysql_rm_dbP3THDPcbb+0x902)[0x6aae32]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x3811)[0x6d7b71]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x32f)[0x6d902f]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xe28)[0x6d9f48]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0xcf)[0x6a7aef]
/usr/sbin/mysqld(handle_one_connection+0x47)[0x6a7c17]
/usr/sbin/mysqld(pfs_spawn_thread+0x139)[0x9470e9]
/lib64/libpthread.so.0[0x3dd6407851]
/lib64/libc.so.6(clone+0x6d)[0x3dd5ce890d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f57800034c0): is an invalid pointer
Connection ID (thread ID): 4
Status: NOT_KILLED

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.
130508 19:01:53 mysqld_safe Number of processes running now: 0
130508 19:01:53 mysqld_safe mysqld restarted
2013-05-08 19:01:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2013-05-08 19:01:53 12765 [Note] InnoDB: The InnoDB memory heap is disabled
2013-05-08 19:01:53 12765 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-05-08 19:01:53 12765 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-05-08 19:01:53 12765 [Note] InnoDB: Using Linux native AIO
2013-05-08 19:01:53 12765 [Note] InnoDB: Using CPU crc32 instructions
2013-05-08 19:01:53 12765 [Note] InnoDB: Initializing buffer pool, size = 40.0G
2013-05-08 19:01:56 12765 [Note] InnoDB: Completed initialization of buffer pool
2013-05-08 19:01:56 12765 [Note] InnoDB: Highest supported file format is Barracuda.
2013-05-08 19:01:56 12765 [Note] InnoDB: Log scan progressed past the checkpoint lsn 19580249921
2013-05-08 19:01:56 12765 [Note] InnoDB: Database was not shutdown normally!
2013-05-08 19:01:56 12765 [Note] InnoDB: Starting crash recovery.
2013-05-08 19:01:56 12765 [Note] InnoDB: Reading tablespace information from the .ibd files...
2013-05-08 19:01:56 12765 [Note] InnoDB: Restoring possible half-written data pages
2013-05-08 19:01:56 12765 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 19580377255
2013-05-08 19:01:56 12765 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
2013-05-08 19:01:57 12765 [Note] InnoDB: 128 rollback segment(s) are active.
2013-05-08 19:01:57 12765 [Note] InnoDB: Waiting for purge to start
2013-05-08 19:01:57 12765 [Note] InnoDB: 5.6.11 started; log sequence number 19580377255
2013-05-08 19:01:57 12765 [Note] Server hostname (bind-address): '*'; port: 3306
2013-05-08 19:01:57 12765 [Note] IPv6 is not available.
2013-05-08 19:01:57 12765 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2013-05-08 19:01:57 12765 [Note] Server socket created on IP: '0.0.0.0'.
2013-05-08 19:01:58 12765 [Note] Event Scheduler: Loaded 0 events
2013-05-08 19:01:58 12765 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.11-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
@y-ken
Copy link
Author

y-ken commented May 16, 2013

「mroonga(groonga)の.mrnファイルがlock failedとなった場合の復旧方法」は以下にまとめております。
http://y-ken.hatenablog.com/entry/how-to-unlock-mroonga-database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment