Your message dated Mon, 2 Jul 2018 00:04:05 +0300
with message-id
<CAHj_TLCHr7hfPjnvHo8RRsjqH1a=q68ur2ymyrwr+t6q-dj...@mail.gmail.com>
and subject line mariadb-connector-c: Disable internal Dbug support as a source
of crashes
has caused the Debian Bug report #880197,
regarding mariadb-connector-c: Disable internal Dbug support as a source of
crashes
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
880197: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880197
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Source: mariadb-connector-c
Source-Version: 2.3.2-2
Severity: serious
Tags: patch
Hi!
While packaging the mariadb-connector-odbc for internal use, we
started to notice crashes in asterisk due to the ODBC asterisk plugin.
The problem ended up being an abort initiated by the internal Dbug code
within mariadb-connector-c's libmariadb.a that the mariadb-connector-odbc
statically links against.
Skimming over the code revealed that there's at least one function with
an unbalanced DBUG_RETURN(), but even after patching that the plugin
was still crashing. Checking the latest mariadb-connector-c upstream
shows that the Dbug support has been completely removed there, so
instead of trying to track it down, followed the same path. Our asterisk
instance using its odbc plugin that uses mariadb-connector-odbc is
working fine now.
I think this is serious enough that it should be fixed in a stable
update. Here's an example backtrace of such crashes:
,---
Core was generated by `/usr/sbin/asterisk -p -g -U asterisk'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f454b05b700 (LWP 19858))]
(gdb) bt full
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
set = {__val = {0, 94034738822584, 139935588123936, 5655481737,
94034738821728, 139935588123920, 139935689551805, 252833149,
4294967295, 0, 139937266863576, 139937324438456, 0, 0,
8227920807149371393, 7814153793824583285}}
pid = <optimized out>
tid = <optimized out>
#1 0x00007f45af17e3fa in __GI_abort () at abort.c:89
save_stage = 2
act = {__sigaction_handler = {sa_handler = 0x424420676e697373,
sa_sigaction = 0x424420676e697373}, sa_mask = {__val = {
5932740740841949013, 266287972354, 139937080938440,
139935588124576, 139935689985411, 0, 2, 139935588124976,
139935689791148, 0, 2880, 0, 139937270617936, 139937270613280,
139937270617936, 139935588136704}}, sa_flags = -1357180916,
sa_restorer = 0x55862994d2c0 <stderr>}
sigs = {__val = {32, 0 <repeats 15 times>}}
#2 0x00007f455112ba21 in DbugExit ()
from /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
No symbol table info available.
#3 0x00007f45511508b5 in _db_return_ ()
from /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
No symbol table info available.
#4 0x00007f4551157dbe in mysql_reconnect ()
from /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
No symbol table info available.
#5 0x00007f455115800d in mthd_my_send_cmd ()
from /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
No symbol table info available.
#6 0x00007f4551154570 in mysql_ping ()
from /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
No symbol table info available.
#7 0x00007f4551138638 in MADB_DbcGetAttr (Dbc=0x55862b3464b0,
Attribute=1209, ValuePtr=0x7f454b0591d8, BufferLength=0,
StringLengthPtr=0x0, isWChar=<optimized out>) at ./ma_connection.c:309
No locals.
#8 0x00007f45511313b4 in MA_SQLGetConnectAttr (
ConnectionHandle=0x55862b3464b0, Attribute=1209, ValuePtr=0x7f454b0591d8,
BufferLength=0, StringLengthPtr=0x0) at ./odbc_3_api.c:1660
Dbc = 0x55862b3464b0
ret = <optimized out>
`---
And attached the patch we ended up using. Although just forcing
-DDBUG_OFF would be enough.
Thanks,
Guillem
Description: Fix crashes due to internal Dbug support
The mysql_ping() function is using an unbalanced DBUG_ENTER() on entry,
but not DBUG_RETURN() on return, which means that the stack frame that
is being checked in _db_return_ will get out of sync, and eventually it
will abort the plugin.
.
Although this fix is not enough and the library keeps crashing. Instead
follow a similar route upstream has taken in git master (removing the
Dbug support) by completely disabling its support.
Origin: other, Sipwise
Author: Guillem Jover <gjo...@sipwise.com>
Last-Update: 2017-10-18
---
---
CMakeLists.txt | 2 ++
libmariadb/libmariadb.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
--- a/libmariadb/libmariadb.c
+++ b/libmariadb/libmariadb.c
@@ -2903,7 +2903,7 @@ mysql_ping(MYSQL *mysql)
/* if connection was terminated and reconnect is true, try again */
if (rc!=0 && mysql->reconnect)
rc= simple_command(mysql,MYSQL_COM_PING,0,0,0,0);
- return rc;
+ DBUG_RETURN(rc);
}
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,6 +71,8 @@ SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLA
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
+# XXX: Disable dbug information for all builds, it causes crashes.
+ADD_DEFINITIONS(-DDBUG_OFF)
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wno-uninitialized")
--- End Message ---
--- Begin Message ---
Version: 3.0.3-1
This issue is no longer present in the MariaDB Connector C series, so
closing issue.
I did some experiments trying to build with -DDBUG_OFF and
-DDBUG_OFF=1 but the builds fail, so there does not seem to be support
for such a flag.
Parse error in command line argument: -DDBUG_OFF
make: *** unknown output-sync type '=true'. Stop.
Anyway, it does not matter, as this does not apply for 3.x anyway.
--- End Message ---