maria-discuss team mailing list archive
-
maria-discuss team
-
Mailing list archive
-
Message #05708
[MariaDB 10.3.7] Hello, everyone. My process core dumped while calling mysql_ping().
-
To:
"maria-developers@xxxxxxxxxxxxxxxxxxx" <maria-developers@xxxxxxxxxxxxxxxxxxx>, "maria-discuss@xxxxxxxxxxxxxxxxxxx" <maria-discuss@xxxxxxxxxxxxxxxxxxx>
-
From:
Ma Allen <mazhh@xxxxxxxxxxx>
-
Date:
Tue, 14 Jan 2020 06:33:28 +0000
-
Accept-language:
zh-CN, en-US
-
Arc-authentication-results:
i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
-
Arc-message-signature:
i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2yyNq7IT8BN1KyWU7gUUmaM2uA8VcnaqrvEs6m76rHE=; b=Kedg+LUDY77T5bv152V4SYmDsUzXcg8Q7RpRUpXKUEVmKNe6w2I8NePOICqG2tJbloYdb6vLSgQXiLo0EQdFBES+bgxx7ne8PHxrSLKfuLzV+fLD1TdmaOnFFVg5Ka+aaDwKHRhl6HpNa4iKyVmJTr0Xnn4l4BkVj1umG+98qIdyVOjvf2c3H4NFTEg8LeQGqPeoJATnqbo1oNgEW4c4oEztztHKjyYNFaakoAhrSp++HivURqTNPMxPKrjnRHHF9V9385U5AbLcGXkxj9YBjkQkcxXNY29Hn2AP9eP8Oa1lnRBkKycRU/x2ISHPaJicjg0S8Axq6GQfcHGtneLvtA==
-
Arc-seal:
i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MexHXW+NjRZDEcZsmukVn0gqRzuDUHBht+Y5ioW9pUsXa7SoEb6p9L7QTaDTsjBQEOiDh2jJdnKJPsoh8dCDh9pfD92EcgDAtk0QmyI9mRkb71oa9s2SWCnXp/LLQGXjeyPt/C0LJ6YnvLEGEAPxTBCH7/aOM9pWBXxPZIN+8n0dgwXklVhEQP5sokTKjq1gaPgo0qaJ7tNqZEdUZBt8LQyFx5Ud5oSvQO8+gh+eNGSQtl/qotjxaq79NvzirLUF2rJOvwNJcW1y0UT28Z8itM+PqcFnTzVys7NYqqF3uxBv27JomIv0Ic7QEbG6Aztoz1CG+3QKvk7VXliuoWEEZw==
-
Thread-index:
AQHVyqBxdfUIAXmGU0Wx0YaP0x0gfg==
-
Thread-topic:
[MariaDB 10.3.7] Hello, everyone. My process core dumped while calling mysql_ping().
Environment:
MariaDB 10.3.7 database server & related headers and libraries
CentOS 7.3 or 7.4
./configure --prefix=/home/spiderflow --localstatedir=/home/spiderflow --enable-unix-socket --with-libnss-libraries=/usr/lib64 --with-libnss-includes=/usr/include/nss3 --with-libnspr-libraries=/usr/lib64 --with-libnspr-includes=/usr/include/nspr4 --enable-netmap --enable-rust --disable-gccmarch-native --enable-mysql --with-libmysql-includes=/usr/local/mariadb-10.3.7-linux-systemd-x86_64/include/mysql --with-libmysql-libraries=/usr/local/mariadb-10.3.7-linux-systemd-x86_64/lib
Phenomenon:
(gdb)
#0 ma_pvio_write (pvio=0x10101010101b2e0, buffer=buffer@entry=0x2510101 "\001", length=length@entry=5)
at /home/buildbot/buildbot/build/libmariadb/libmariadb/ma_pvio.c:350
#1 0x00007f7100249dea in ma_net_real_write (net=net@entry=0xee9de0 <g_mysql_info>, packet=0x2510101 "\001", len=5)
at /home/buildbot/buildbot/build/libmariadb/libmariadb/ma_net.c:335
#2 0x00007f7100249f60 in ma_net_flush (net=net@entry=0xee9de0 <g_mysql_info>) at /home/buildbot/buildbot/build/libmariadb/libmariadb/ma_net.c:166
#3 0x00007f710024a71a in ma_net_write_command (net=net@entry=0xee9de0 <g_mysql_info>, command=command@entry=14 '\016', packet=packet@entry=0x7f71003d6c67 "", len=0,
disable_flush=disable_flush@entry=0 '\000') at /home/buildbot/buildbot/build/libmariadb/libmariadb/ma_net.c:244
#4 0x00007f7100252ca4 in mthd_my_send_cmd (mysql=0xee9de0 <g_mysql_info>, command=<optimized out>, arg=0x7f71003d6c67 "", length=0, skipp_check=<optimized out>,
opt_arg=<optimized out>) at /home/buildbot/buildbot/build/libmariadb/libmariadb/mariadb_lib.c:394
#5 0x00007f71002518d0 in mysql_ping (mysql=0xee9de0 <g_mysql_info>) at /home/buildbot/buildbot/build/libmariadb/libmariadb/mariadb_lib.c:2552
#6 0x00000000006651b2 in MySqlWaitConnected (p_mysql_data=p_mysql_data@entry=0xee9de0 <g_mysql_info>) at ../srcSF/spiderFlow-proto-baseline.c:676
#7 0x0000000000668819 in LoadProtoConfInfos (pInfo=pInfo@entry=0xee9de0 <g_mysql_info>) at ../srcSF/spiderFlow-proto-baseline.c:835
#8 0x000000000066c53a in InitBaseLine () at ../srcSF/spiderFlow-proto-baseline.c:1069
#9 0x00000000005f308b in PostConfLoadedSetup (suri=0x10dbb80 <suricata>) at suricata.c:2900
#10 0x0000000000425ce8 in main (argc=5, argv=0x7fff1cdca258) at suricata.c:3072
(gdb)
Analyzation:
The core dump always exists after running for a while or maybe after the sever restarts. It occurs at the initialization and involves with ONLY ONE thread, which is the main thread of the whole process.
The related code is two functions, which both checks the connection and read data from MariaDB. The first function works fine, however, the second one's checking connection leads to core dump.
The code to check connection is as follows:
void MySqlWaitConnected(MYSQL * p_mysql_data)
{
while (mysql_ping(p_mysql_data) != 0) {
SCLogInfo("Mysql ping error:%s", mysql_error(p_mysql_data));
#ifdef WIN32
Sleep(3000);
#else
sleep(3);
#endif
}
}
Previously, I solved a likely similar problem as follows:
Multiple threads shared ONE MySQL handler, which is the MYSQL data structure. Before inserting data into MariaDB without mutex, MySqlWaitConnected() is called. So while multiple threads do the same operation, inserting data is interrupted by mysql_ping() that leads to core dump. Afterwards, I comment MySqlWaitConnected() and add mutex for mysql_real_query() and mysql_commit().
Does anyone meet the same problem before? Any suggestion is appreciated. Thanks in advance.
Best Regards,
Allen Ma
Follow ups