tdbc::mysql

View Ticket
Login
Ticket Hash: 79e85de7882bb39998f9685dfdeaf44b8f127dbd
Title: tdbc::mysql "allrows" and "prepare" statements segmentation faults on mariadb-libs above 10.5.11
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: tdbc::mysql Resolution: Fixed
Last Modified: 2022-09-17 18:55:32
Version Found In: 1.1.3
User Comments:
anonymous added on 2022-09-04 05:47:37:

tdbcmyslq version 1.1.3 works fine only with mariadb mariadb-libs and mariadb-clients up to 10.5.11

On higher versions of mariadb-libs allrows and prepare statements make segfault.

My code:

package require tdbc::mysql

namespace import ::tdbc::mysql::*

connection create db -host 127.0.0.1 -port 3306 -passwd mypass -user root -database mydb

#working on all configs

db evaldirect "select product_id from product_to_category where category_id=555"

#seg fault on mariadb and mariadb-libs above 10.5.11

db allrows { select * from category_description }

db prepare { select * from category_description }

This code segfaults on latest Arch linux distribution,and latest Alpine linux server with mariadb-client and mariadb-libs 10.6.9.

And it works fine if i downgrade mariadb-libs to 10.5.11


anonymous added on 2022-09-04 07:15:59:

in dmesg output i see this lines:

segfault at 0 ip 00007fc1bf099540 sp 00007fff15f35668 error 4 in libtcl8.6.so[7fc1befe3000+140000]

Code: 7e 18 48 8d 14 86 31 c0 66 90 03 06 48 83 c6 04 48 39 d6 75 f5 c3 0f 1f 40 00 31 c0 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 <44> 0f b6 06 45 85 c0 74 21 0f b6 46 01 48 8d 56 01 84 c0 74 15 0f


anonymous added on 2022-09-15 07:42:13:
and  here is core dump 
coredumpctl   dump eltclsh
           
          PID: 39838 (eltclsh)
           UID: 1000 (qq)
           GID: 1000 (qq)
        Signal: 11 (SEGV)
     Timestamp: Thu 2022-09-15 10:07:54 MSK (8min ago)
  Command Line: eltclsh
    Executable: /usr/bin/eltclsh
 Control Group: /user.slice/user-1000.slice/session-2.scope
          Unit: session-2.scope
         Slice: user-1000.slice
       Session: 2
     Owner UID: 1000 (qq)
       Boot ID: 3f23256544a94a34b850af60da2eb4d6
    Machine ID: 25ea887d4f2e4f3e8eb7bb85cc740517
      Hostname: qq
       Storage: /var/lib/systemd/coredump/core.eltclsh.1000.3f23256544a94a34b850af60da2eb4d6.39838.1663225674000000.zst (present)
     Disk Size: 635.4K
       Message: Process 39838 (eltclsh) of user 1000 dumped core.
               
                Module linux-vdso.so.1 with build-id 1686649ed9e6cab45b7f5fc7ec9ba72cdd893077
                Module libcrypto.so.1.1 with build-id 7981ea3d69f3c28e46ee312a815af96eab93775c
                Module libssl.so.1.1 with build-id e6b1f97a5b60b4248c49dfc5b11f53f281b507d0
                Module libmysqlclient_r.so with build-id 97fc2413ba5fa1542949b3a01c352206c630a036
                Module libtdbcmysql1.1.3.so with build-id 4c135dfc08c14c361a2c74eddb5ae09cc5c6d3f3
                Module libtdbc1.1.3.so with build-id f3a4eaa97ab0dcc43e9416b9871b07032af697eb
                Module libncursesw.so.6 with build-id b9917757481e6fa6097e2a1f31f5bb5eaf138c4e
                Module libedit.so.0 with build-id 4b0babfcad161c2ad0af6e59e2493258db23a331
                Module libeltclsh.so with build-id c8adf3a6e8d822b831c57a28ac6f6001037331e6
                Module ld-linux-x86-64.so.2 with build-id da64753d57bf3801827448f53d911b041568e727
                Module libm.so.6 with build-id 0b8d43ea2dae21a1c5e44c3f0a9dc2fb292d27c0
                Module libpthread.so.0 with build-id 135923f9a38592e2e90692c8191278a166f86569
                Module libz.so.1 with build-id fefe3219a96d682ec98fcfb78866b8594298b5a2
                Module libdl.so.2 with build-id 3b5b9c7c3efd20001319657d1972e90e853984e2
                Module libc.so.6 with build-id 9c28cfc869012ebbd43cdb0f1eebcd14e1b8bdd8
                Module libtcl8.6.so with build-id ac9b1705f252e7904396c5d63ceb7d8905762f71
                Module eltclsh with build-id 6772c02be03d9905797cf3e39654f003ec2a9e92
                Stack trace of thread 39838:
                #0  0x00007f08e7d5c540 HashStringKey (libtcl8.6.so + 0xe0540)
                #1  0x00007f08e7d5c785 CreateHashEntry (libtcl8.6.so + 0xe0785)
                #2  0x00007f08e7e5055c n/a (libtdbcmysql1.1.3.so + 0x555c)
                #3  0x00007f08e7dd3300 TclOO_Class_Create (libtcl8.6.so + 0x157300)
                #4  0x00007f08e7dd158d TclOOObjectCmdCore (libtcl8.6.so + 0x15558d)
                #5  0x00007f08e7cbccd2 TclNRRunCallbacks (libtcl8.6.so + 0x40cd2)
                #6  0x00007f08e7d5d175 Tcl_RecordAndEvalObj (libtcl8.6.so + 0xe1175)
                #7  0x00007f08e7e62dad elTclInteractive (libeltclsh.so + 0x3dad)
                #8  0x00007f08e7cbccd2 TclNRRunCallbacks (libtcl8.6.so + 0x40cd2)
                #9  0x00007f08e7cbebdb TclEvalEx (libtcl8.6.so + 0x42bdb)
                #10 0x00007f08e7cbf3f3 Tcl_EvalEx (libtcl8.6.so + 0x433f3)
                #11 0x00007f08e7cbf417 Tcl_Eval (libtcl8.6.so + 0x43417)
                #12 0x000055ba80182468 n/a (eltclsh + 0x1468)
                #13 0x000055ba8018202c n/a (eltclsh + 0x102c)
                #14 0x00007f08e7ab82d0 n/a (libc.so.6 + 0x232d0)
                #15 0x00007f08e7ab838a __libc_start_main (libc.so.6 + 0x2338a)
                #16 0x000055ba80182065 n/a (eltclsh + 0x1065)
               
                Stack trace of thread 39839:
                #0  0x00007f08e7b9267c __select (libc.so.6 + 0xfd67c)
                #1  0x00007f08e7dcdc0e NotifierThreadProc (libtcl8.6.so + 0x151c0e)
                #2  0x00007f08e7b1b78d n/a (libc.so.6 + 0x8678d)
                #3  0x00007f08e7b9c8e4 __clone (libc.so.6 + 0x1078e4)
                ELF object binary architecture: AMD x86-64

kbk added on 2022-09-17 18:42:43:

Fixed with commit [9d2d1595b84]

MariaDB reset the client library version number when it forked, leading to versions that looked as if they needed to use ABI compatible with an older MySQL client version.

Problem never appeared on my MariaDB test system because it had libmysqlclient.so installed as well as libmariadbclient.so and the MySQL client came up first on the path. (The MySQL client works fine with a MariaDB server.


kbk added on 2022-09-17 18:55:32:

Fixed in 1.1.5