Hironori Matsubara
t0392****@gmail*****
2015年 11月 10日 (火) 11:02:17 JST
はじめまして、松原と申します。 (個人で・会社で、mroongaを利用させていただいております) (大変便利なものを、いつもありがとうございます) このたび、おそらく mroonga_snippet 付近が原因で、 mysqldが数時間おきにクラッシュする問題が起きており、 解決のヒントがないか相談させていただければと思いました。 ■環境 ・CentOS 6.7 x86_64 (最新) ・MySQL 5.6.27 (Oracle社レポジトリ) ・groonga 5.0.9, mroonga 5.09 (groongaレポジトリ) ※5.07では発生しませんでした ※5.08で発生を確認し、5.09でも解消しませんでした ■クラッシュ時のログ(抜粋) /usr/sbin/mysqld(my_print_stacktrace+0x35)[0x8e1555] /usr/sbin/mysqld(handle_fatal_signal+0x494)[0x6678e4] /lib64/libpthread.so.0[0x3a0b60f790] /usr/lib64/libgroonga.so.0(grn_ctx_use+0x60)[0x3a8ea41480] /usr/lib64/mysql/plugin/ha_mroonga.so(mroonga_snippet_init+0x480)[0x7f6ce9a9f320] ※全文を末尾に貼り付けました ■再現性 mroonga_snippet() 関数を使ったSQLを流すときに発生している様子 ※使うと必ずクラッシュするわけではなく、たいていは正常に取得できるケースが多く、あるタイミングで(数時間に1回程度)mysqld自体がクラッシュするようです (もう少し再現性を突き止められればよいのですが…) ※サーバ固有ではなく、同様の構成のサーバ3台で現象を確認しました ※インデックスが壊れている可能性も考え、mysqldumpして再投入などしましたが、解消しませんでした ■テーブル定義 CREATE TABLE `report_fulltext` ( `id` int(11) NOT NULL, `title` varchar(255) DEFAULT NULL, `body` text, `related_texts` text, PRIMARY KEY (`id`), FULLTEXT KEY `idx_report_fulltext` (`title`,`body`,`related_texts`) COMMENT 'parser "TokenMecab"' ) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT='engine "innodb"'; ■SQL例 SELECT `ReportFulltext`.`id`, mroonga_snippet(ReportFulltext.title, 1000, 1, 'utf8mb4_general_ci', 1, 1, '', '' , 'テスト', '<mark>', '</mark>') title, mroonga_snippet(ReportFulltext.body, 200, 2, 'utf8mb4_general_ci', 1, 1, '...', '...' , 'テスト', '<mark>', '</mark>') body FROM `main`.`report_fulltext` AS `ReportFulltext` WHERE `id` IN (5705, 1869, 589, 1244, 2641, 2817, 7263, 8093, 6070, 1343); 開発者の方で、なにかわかることなどあれば、ご教示いただけると助かります。 どうぞよろしくお願いします。 ---------- ※MySQLクラッシュ時の /var/log/mysqld.log 2015-11-10 08:50:27 12143 [Note] Plugin 'FEDERATED' is disabled. 2015-11-10 08:50:27 12143 [Note] InnoDB: Using atomics to ref count buffer pool pages 2015-11-10 08:50:27 12143 [Note] InnoDB: The InnoDB memory heap is disabled 2015-11-10 08:50:27 12143 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2015-11-10 08:50:27 12143 [Note] InnoDB: Memory barrier is not used 2015-11-10 08:50:27 12143 [Note] InnoDB: Compressed tables use zlib 1.2.3 2015-11-10 08:50:27 12143 [Note] InnoDB: Using Linux native AIO 2015-11-10 08:50:27 12143 [Note] InnoDB: Using CPU crc32 instructions 2015-11-10 08:50:27 12143 [Note] InnoDB: Initializing buffer pool, size = 2.9G 2015-11-10 08:50:27 12143 [Note] InnoDB: Completed initialization of buffer pool 2015-11-10 08:50:27 12143 [Note] InnoDB: Highest supported file format is Barracuda. 2015-11-10 08:50:27 12143 [Note] InnoDB: The log sequence numbers 258909079275 and 258909079275 in ibdata files do not match the log sequence number 260278534049 in the ib_logfiles! 2015-11-10 08:50:27 12143 [Note] InnoDB: Database was not shutdown normally! 2015-11-10 08:50:27 12143 [Note] InnoDB: Starting crash recovery. 2015-11-10 08:50:27 12143 [Note] InnoDB: Reading tablespace information from the .ibd files... 2015-11-10 08:50:27 12143 [Note] InnoDB: Restoring possible half-written data pages 2015-11-10 08:50:27 12143 [Note] InnoDB: from the doublewrite buffer... InnoDB: Last MySQL binlog file position 0 199394, file name mysql-bin.000352 2015-11-10 08:50:28 12143 [Note] InnoDB: 128 rollback segment(s) are active. 2015-11-10 08:50:28 12143 [Note] InnoDB: Waiting for purge to start 2015-11-10 08:50:28 12143 [Note] InnoDB: 5.6.27 started; log sequence number 260278534049 2015-11-10 08:50:28 12143 [Note] Recovering after a crash using mysql-bin 2015-11-10 08:50:28 12143 [Note] Starting crash recovery... 2015-11-10 08:50:28 12143 [Note] Crash recovery finished. 2015-11-10 08:50:28 12143 [Note] Server hostname (bind-address): '*'; port: 3306 2015-11-10 08:50:28 12143 [Note] IPv6 is available. 2015-11-10 08:50:28 12143 [Note] - '::' resolves to '::'; 2015-11-10 08:50:28 12143 [Note] Server socket created on IP: '::'. 2015-11-10 08:50:28 12143 [Note] Event Scheduler: Loaded 0 events 2015-11-10 08:50:28 12143 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.6.27-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) 01:13:13 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=8388608 read_buffer_size=131072 max_used_connections=76 max_threads=150 thread_count=75 connection_count=75 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 336511 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. Thread pointer: 0x86cd620 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 = 7f6c1c07ee18 thread_stack 0x40000 /usr/sbin/mysqld(my_print_stacktrace+0x35)[0x8e1555] /usr/sbin/mysqld(handle_fatal_signal+0x494)[0x6678e4] /lib64/libpthread.so.0[0x3a0b60f790] /usr/lib64/libgroonga.so.0(grn_ctx_use+0x60)[0x3a8ea41480] /usr/lib64/mysql/plugin/ha_mroonga.so(mroonga_snippet_init+0x480)[0x7f6ce9a9f320] /usr/sbin/mysqld(_ZN11udf_handler10fix_fieldsEP3THDP17Item_result_fieldjPP4Item+0x572)[0x605742] /usr/sbin/mysqld(_ZN13Item_udf_func10fix_fieldsEP3THDPP4Item+0x28)[0x60e1f8] /usr/sbin/mysqld(_Z12setup_fieldsP3THD20Bounds_checked_arrayIP4ItemER4ListIS2_E17enum_mark_columnsPS6_b+0x121)[0x696511] /usr/sbin/mysqld(_ZN4JOIN7prepareEP10TABLE_LISTjP4ItemjP8st_orderS5_S3_P13st_select_lexP18st_select_lex_unit+0x40c)[0x70046c] /usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x890)[0x708cb0] /usr/sbin/mysqld(_Z13handle_selectP3THDP13select_resultm+0x1a7)[0x708f17] /usr/sbin/mysqld[0x6e2e6d] /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x159f)[0x6e569f] /usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x3c0)[0x6e9290] /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1528)[0x6ea868] /usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0xcf)[0x6b62bf] /usr/sbin/mysqld(handle_one_connection+0x47)[0x6b63e7] /usr/sbin/mysqld(pfs_spawn_thread+0x12a)[0xb0e17a] /lib64/libpthread.so.0[0x3a0b607a51] /lib64/libc.so.6(clone+0x6d)[0x3a0b2e893d] Trying to get some variables. Some pointers may be invalid and cause the dump to abort. Query (7f6c0467f610): is an invalid pointer Connection ID (thread ID): 590 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. 151110 10:13:13 mysqld_safe Number of processes running now: 0 151110 10:13:13 mysqld_safe mysqld restarted 2015-11-10 10:13:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2015-11-10 10:13:13 0 [Note] /usr/sbin/mysqld (mysqld 5.6.27-log) starting as process 14830 ...