MySQL 服务器停止 运行 从 C# 应用程序发送的特定查询
MySQL Server stops running on specific query sent from C# application
我正在开发一个 C# 程序,它与在 MySQL 服务器上运行的数据库进行交互。
在此程序对该数据库执行的许多查询中,其中之一如下。
从 C# 程序发送:
string query = $"select * from ((select id,title from wikipedia where lang like ('{string.Join(",", pLang)}') and title<>'') union all (select id, redirect 'title' from redirect where lang like '{string.Join(",", pLang)}' and redirect<>''))r;";
作为发送到数据库的字符串:
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r;
偶尔,此数据库的 MySQL 服务器会在执行此特定查询时关闭(到目前为止,其他任何查询都没有发生过)
我第一次发现这个问题是在从用于测试的一小部分数据更改为需要定期处理的较大数据集的几天后。
目前该查询使用的表分别包含 ~7800000 行和 ~699000 行。
每当发生这种情况时,服务器将在程序发送查询后立即关闭。
错误日志:
10:03:31 UTC - mysqld got exception 0xc0000005 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x12d7ded4390
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...
7ff7d8e82c1e mysqld.exe!?strncpyz@Event_reader@binary_log@@QEAAXPEAD_K1@Z()
7ff7d8e7f8f9 mysqld.exe!?strncpyz@Event_reader@binary_log@@QEAAXPEAD_K1@Z()
7ff7d7f577ed mysqld.exe!?free_tmp_table@@YAXPEAVTHD@@PEAUTABLE@@@Z()
7ff7d7efb21f mysqld.exe!?deallocate@?$allocator@V?$unique_ptr@VRowIterator@@V?$Destroy_only@VRowIterator@@@@@std@@@std@@QEAAXQEAV?$unique_ptr@VRowIterator@@V?$Destroy_only@VRowIterator@@@@@2@_K@Z()
7ff7d7efa3f7 mysqld.exe!?cleanup@SELECT_LEX@@QEAA_NPEAVTHD@@_N@Z()
7ff7d7efa4ff mysqld.exe!?cleanup@SELECT_LEX_UNIT@@QEAA_NPEAVTHD@@_N@Z()
7ff7d7d83289 mysqld.exe!?mysql_execute_command@@YAHPEAVTHD@@_N@Z()
7ff7d7d839c4 mysqld.exe!?mysql_parse@@YAXPEAVTHD@@PEAVParser_state@@@Z()
7ff7d7d7cb60 mysqld.exe!?dispatch_command@@YA_NPEAVTHD@@PEBTCOM_DATA@@W4enum_server_command@@@Z()
7ff7d7d7dade mysqld.exe!?do_command@@YA_NPEAVTHD@@@Z()
7ff7d7bfcfc8 mysqld.exe!?modify_thread_cache_size@Per_thread_connection_handler@@SAXK@Z()
7ff7d8e087a1 mysqld.exe!?strncpyz@Event_reader@binary_log@@QEAAXPEAD_K1@Z()
7ff7d8a4606c mysqld.exe!?my_thread_join@@YAHPEAUmy_thread_handle@@PEAPEAX@Z()
7ffe89991ffa ucrtbase.dll!_o_exp()
7ffe8a577974 KERNEL32.DLL!BaseThreadInitThunk()
7ffe8d38a261 ntdll.dll!RtlUserThreadStart()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (12d7e5f0c98): select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r
Connection ID (thread ID): 66
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.
2020-04-15T10:04:19.511132Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-04-15T10:04:19.515876Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.19) starting as process 5660
2020-04-15T10:04:22.501909Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2020-04-15T10:04:22.510760Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2020-04-15T10:04:23.072748Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-04-15T10:04:23.119390Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.19' socket: '' port: 3306 MySQL Community Server - GPL.
2020-04-15T10:04:23.276080Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
慢日志:
SET timestamp=1586941541;
select distinct(id) from wikipedia where lang like ('es');
# Time: 2020-04-15T09:09:10.701455Z
# User@Host: root[root] @ localhost [127.0.0.1] Id: 63
# Query_time: 104.064637 Lock_time: 0.000074 Rows_sent: 6578886 Rows_examined: 8306925
SET timestamp=1586941646;
select distinct(id) from wikipedia where lang like ('en');
# Time: 2020-04-15T10:02:11.919601Z
# User@Host: root[root] @ localhost [127.0.0.1] Id: 65
# Query_time: 26.851506 Lock_time: 0.001500 Rows_sent: 2969442 Rows_examined: 2969442
SET timestamp=1586944905;
select * from ((select id,title from wikipedia where lang like ('es') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'es' and redirect<>''))r;
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe, Version: 8.0.19 (MySQL Community Server - GPL). started with:
TCP Port: 3306, Named Pipe: MySQL
Time Id Command Argument
在过去的一周里,我一直在努力寻找这个问题的原因,但我似乎无法随意重现它。有时查询会毫无问题地得到回答(当从程序发送时),如慢日志所示:
# Time: 2020-04-15T06:04:55.984006Z
# User@Host: root[root] @ localhost [127.0.0.1] Id: 60
# Query_time: 74.830395 Lock_time: 0.000663 Rows_sent: 12234243 Rows_examined: 12234243
SET timestamp=1586930621;
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r;
我也尝试过多次直接从 MySQL Workbench 执行查询(但同样,没有重现服务器关闭。如下所示)
LIMIT 0, 1000;
# Time: 2020-04-15T14:33:01.406478Z
# User@Host: root[root] @ localhost [::1] Id: 15
# Query_time: 22.342847 Lock_time: 0.002968 Rows_sent: 12234315 Rows_examined: 12234315
SET timestamp=1586961159;
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r limit 1000000000;
# Time: 2020-04-15T14:36:12.223454Z
# User@Host: root[root] @ localhost [::1] Id: 15
# Query_time: 22.223628 Lock_time: 0.000161 Rows_sent: 12234315 Rows_examined: 12234315
SET timestamp=1586961349;
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r limit 1000000000;
感谢您阅读到这里,并预先感谢您可能提供的任何 help/suggestion。
根据失败消息:
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
首先要做的是排除故障硬件(很可能是 RAM)。由于看起来您 运行 正在 Windows 上,请使用内置的 Windows 内存诊断来 运行 对您的 RAM 进行压力测试。
然后查看当 MySQL 服务器在 https://dev.mysql.com/doc/refman/8.0/en/crashing.html
崩溃时要采取的步骤列表
如果有 none 个帮助,您可以报告错误(在 https://bugs.mysql.com/) following the steps at https://dev.mysql.com/doc/refman/8.0/en/bug-reports.html
请注意,拥有一个始终可重现的测试用例将大有帮助,因此 MySQL 开发人员可以重现问题并修复它。否则,该错误可能会被关闭 "not reproducible"。您可以做的越多,使崩溃持续发生越好。
我正在开发一个 C# 程序,它与在 MySQL 服务器上运行的数据库进行交互。
在此程序对该数据库执行的许多查询中,其中之一如下。
从 C# 程序发送:
string query = $"select * from ((select id,title from wikipedia where lang like ('{string.Join(",", pLang)}') and title<>'') union all (select id, redirect 'title' from redirect where lang like '{string.Join(",", pLang)}' and redirect<>''))r;";
作为发送到数据库的字符串:
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r;
偶尔,此数据库的 MySQL 服务器会在执行此特定查询时关闭(到目前为止,其他任何查询都没有发生过) 我第一次发现这个问题是在从用于测试的一小部分数据更改为需要定期处理的较大数据集的几天后。
目前该查询使用的表分别包含 ~7800000 行和 ~699000 行。
每当发生这种情况时,服务器将在程序发送查询后立即关闭。
错误日志:
10:03:31 UTC - mysqld got exception 0xc0000005 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x12d7ded4390
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...
7ff7d8e82c1e mysqld.exe!?strncpyz@Event_reader@binary_log@@QEAAXPEAD_K1@Z()
7ff7d8e7f8f9 mysqld.exe!?strncpyz@Event_reader@binary_log@@QEAAXPEAD_K1@Z()
7ff7d7f577ed mysqld.exe!?free_tmp_table@@YAXPEAVTHD@@PEAUTABLE@@@Z()
7ff7d7efb21f mysqld.exe!?deallocate@?$allocator@V?$unique_ptr@VRowIterator@@V?$Destroy_only@VRowIterator@@@@@std@@@std@@QEAAXQEAV?$unique_ptr@VRowIterator@@V?$Destroy_only@VRowIterator@@@@@2@_K@Z()
7ff7d7efa3f7 mysqld.exe!?cleanup@SELECT_LEX@@QEAA_NPEAVTHD@@_N@Z()
7ff7d7efa4ff mysqld.exe!?cleanup@SELECT_LEX_UNIT@@QEAA_NPEAVTHD@@_N@Z()
7ff7d7d83289 mysqld.exe!?mysql_execute_command@@YAHPEAVTHD@@_N@Z()
7ff7d7d839c4 mysqld.exe!?mysql_parse@@YAXPEAVTHD@@PEAVParser_state@@@Z()
7ff7d7d7cb60 mysqld.exe!?dispatch_command@@YA_NPEAVTHD@@PEBTCOM_DATA@@W4enum_server_command@@@Z()
7ff7d7d7dade mysqld.exe!?do_command@@YA_NPEAVTHD@@@Z()
7ff7d7bfcfc8 mysqld.exe!?modify_thread_cache_size@Per_thread_connection_handler@@SAXK@Z()
7ff7d8e087a1 mysqld.exe!?strncpyz@Event_reader@binary_log@@QEAAXPEAD_K1@Z()
7ff7d8a4606c mysqld.exe!?my_thread_join@@YAHPEAUmy_thread_handle@@PEAPEAX@Z()
7ffe89991ffa ucrtbase.dll!_o_exp()
7ffe8a577974 KERNEL32.DLL!BaseThreadInitThunk()
7ffe8d38a261 ntdll.dll!RtlUserThreadStart()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (12d7e5f0c98): select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r
Connection ID (thread ID): 66
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.
2020-04-15T10:04:19.511132Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-04-15T10:04:19.515876Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.19) starting as process 5660
2020-04-15T10:04:22.501909Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2020-04-15T10:04:22.510760Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2020-04-15T10:04:23.072748Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-04-15T10:04:23.119390Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.19' socket: '' port: 3306 MySQL Community Server - GPL.
2020-04-15T10:04:23.276080Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
慢日志:
SET timestamp=1586941541;
select distinct(id) from wikipedia where lang like ('es');
# Time: 2020-04-15T09:09:10.701455Z
# User@Host: root[root] @ localhost [127.0.0.1] Id: 63
# Query_time: 104.064637 Lock_time: 0.000074 Rows_sent: 6578886 Rows_examined: 8306925
SET timestamp=1586941646;
select distinct(id) from wikipedia where lang like ('en');
# Time: 2020-04-15T10:02:11.919601Z
# User@Host: root[root] @ localhost [127.0.0.1] Id: 65
# Query_time: 26.851506 Lock_time: 0.001500 Rows_sent: 2969442 Rows_examined: 2969442
SET timestamp=1586944905;
select * from ((select id,title from wikipedia where lang like ('es') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'es' and redirect<>''))r;
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe, Version: 8.0.19 (MySQL Community Server - GPL). started with:
TCP Port: 3306, Named Pipe: MySQL
Time Id Command Argument
在过去的一周里,我一直在努力寻找这个问题的原因,但我似乎无法随意重现它。有时查询会毫无问题地得到回答(当从程序发送时),如慢日志所示:
# Time: 2020-04-15T06:04:55.984006Z
# User@Host: root[root] @ localhost [127.0.0.1] Id: 60
# Query_time: 74.830395 Lock_time: 0.000663 Rows_sent: 12234243 Rows_examined: 12234243
SET timestamp=1586930621;
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r;
我也尝试过多次直接从 MySQL Workbench 执行查询(但同样,没有重现服务器关闭。如下所示)
LIMIT 0, 1000;
# Time: 2020-04-15T14:33:01.406478Z
# User@Host: root[root] @ localhost [::1] Id: 15
# Query_time: 22.342847 Lock_time: 0.002968 Rows_sent: 12234315 Rows_examined: 12234315
SET timestamp=1586961159;
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r limit 1000000000;
# Time: 2020-04-15T14:36:12.223454Z
# User@Host: root[root] @ localhost [::1] Id: 15
# Query_time: 22.223628 Lock_time: 0.000161 Rows_sent: 12234315 Rows_examined: 12234315
SET timestamp=1586961349;
select * from ((select id,title from wikipedia where lang like ('en') and title<>'') union all (select id, redirect 'title' from redirect where lang like 'en' and redirect<>''))r limit 1000000000;
感谢您阅读到这里,并预先感谢您可能提供的任何 help/suggestion。
根据失败消息:
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
首先要做的是排除故障硬件(很可能是 RAM)。由于看起来您 运行 正在 Windows 上,请使用内置的 Windows 内存诊断来 运行 对您的 RAM 进行压力测试。
然后查看当 MySQL 服务器在 https://dev.mysql.com/doc/refman/8.0/en/crashing.html
崩溃时要采取的步骤列表如果有 none 个帮助,您可以报告错误(在 https://bugs.mysql.com/) following the steps at https://dev.mysql.com/doc/refman/8.0/en/bug-reports.html
请注意,拥有一个始终可重现的测试用例将大有帮助,因此 MySQL 开发人员可以重现问题并修复它。否则,该错误可能会被关闭 "not reproducible"。您可以做的越多,使崩溃持续发生越好。