Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 737002 - dev-db/mydumper with >dev-db/mysql-connector-c-8.0.19: runtime segfault
Summary: dev-db/mydumper with >dev-db/mysql-connector-c-8.0.19: runtime segfault
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Tomáš Mózes
URL: https://github.com/maxbube/mydumper/i...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-13 19:12 UTC by gerion
Modified: 2020-08-19 13:54 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gerion 2020-08-13 19:12:01 UTC
When executing mydumper, I get a segfault:
```
# mydumper -u root -p ... -h localhost -o tmp           
zsh: segmentation fault  mydumper -u root -p ... -h localhost -o tmp
```

I have traced this a little bit with gdb. Here is the output:
```
# gdb --args mydumper -u root -p ... -h localhost -o tmp
GNU gdb (Gentoo 9.2 vanilla) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mydumper...
(No debugging symbols found in mydumper)
(gdb) run
Starting program: /usr/bin/mydumper -u root -p ... -h localhost -o tmp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff6de1700 (LWP 31278)]
[New Thread 0x7ffff65e0700 (LWP 31279)]
[New Thread 0x7ffff5ddf700 (LWP 31281)]
[New Thread 0x7ffff55de700 (LWP 31283)]
[Thread 0x7ffff65e0700 (LWP 31279) exited]
[Thread 0x7ffff6de1700 (LWP 31278) exited]
[Thread 0x7ffff55de700 (LWP 31283) exited]
[Thread 0x7ffff5ddf700 (LWP 31281) exited]

Thread 1 "mydumper" received signal SIGSEGV, Segmentation fault.
0x00007ffff7945e27 in ?? () from /usr/lib64/libmysqlclient.so.21
(gdb) bt
#0  0x00007ffff7945e27 in ?? () from /usr/lib64/libmysqlclient.so.21
#1  0x00007ffff794f56c in ?? () from /usr/lib64/libmysqlclient.so.21
#2  0x00007ffff78e3663 in mysql_server_end () from /usr/lib64/libmysqlclient.so.21
#3  0x000055555555abe7 in main ()
(gdb) quit
```

So it seems that this is a failure in libmysqlclient. This library is provided with dev-db/mysql-connector-c.

Reproducible: Always




I use mydumper as part of an hourly backup script. The first failure has occured yesterday at the same time, I have made a system update. Therefore, my guess is that this system update caused the bug. I have also rebooted the system without success.

The relevant updates should be:
- dev-db/mariadb-10.4.13 to dev-db/mariadb-10.4.13-r2
- dev-db/mysql-connector-c-8.0.19 to dev-db/mysql-connector-c-8.0.21

Both are merged in the hour between the last successful mydumper run and the first failed mydumper run. Since I did not restart mariadb and mysql-connector-c does not link against mariadb, I guess that the mysql-connector-c is responsible.

mydumper was _not_ updated. I have remerged mysql-connector-c and mydumper without success. I'm not sure, if this is an upstream or Gentoo bug.

I also saw that a package dev-db/mariadb-connector-c exists but mydumper wants mysql-connector-c as explicit dependency.
Comment 1 gerion 2020-08-13 19:20:08 UTC
Ok, can confirm my guess. I have manually downgraded to mysql-connector-c (ebuild taken from git history) and the segfault is gone. Should I report this upstream?
Comment 2 Tomáš Mózes 2020-08-14 07:16:41 UTC
Thanks for the report.

It seems to me this is an upstream error, since the ebuild difference between mysql-connector-c 8.0.19 and 8.0.20 is just in the libressl patch. I tried removing it, but the segfault remains the same.

Nevertheless it seems the dump is finished, the segfault comes in the end:

...
** Message: 07:13:47.395: Thread 4 dumping schema for `mysql`.`time_zone_leap_second`
** Message: 07:13:47.395: Thread 2 dumping schema for `mysql`.`time_zone_name`
** Message: 07:13:47.396: Thread 4 dumping schema for `mysql`.`time_zone_transition`
** Message: 07:13:47.396: Thread 1 dumping schema for `mysql`.`time_zone_transition_type`
** Message: 07:13:47.396: Thread 2 dumping schema for `mysql`.`user`
** Message: 07:13:47.421: Non-InnoDB dump complete, unlocking tables
** Message: 07:13:47.421: Thread 4 shutting down
** Message: 07:13:47.421: Thread 2 shutting down
** Message: 07:13:47.421: Thread 1 shutting down
** Message: 07:13:47.421: Thread 3 shutting down
** Message: 07:13:47.422: Finished dump at: 2020-08-14 07:13:47

Segmentation fault

Is that same for you?

In either case, please report upstream, I believe this is an upstream issue (maybe a breaking change in mysql-connector-c).
Comment 3 Tomáš Mózes 2020-08-14 07:17:22 UTC
Reproduced with mysql-connector-c-8.0.20 and mysql-connector-c-8.0.21 on ~amd64.
Comment 4 gerion 2020-08-14 14:08:21 UTC
(In reply to Tomáš Mózes from comment #2)
> Nevertheless it seems the dump is finished, the segfault comes in the end:
> ...
> Is that same for you?
Yes.

 
> In either case, please report upstream, I believe this is an upstream issue
> (maybe a breaking change in mysql-connector-c).
Done: https://github.com/maxbube/mydumper/issues/266
Comment 5 Tomáš Mózes 2020-08-14 14:14:04 UTC
(In reply to gerion from comment #4)
> Done: https://github.com/maxbube/mydumper/issues/266

Thanks
Comment 6 Peter Große 2020-08-19 09:44:18 UTC
This is due to an backwards imcompatible change in libmysqlclient somewhere.

I know that libmysqlclient is not garanteed to work with mariadb servers.
This bug seems to be a case of that.

What causes the segfault is a mismatch of charset files which leads to a pointer being null, which is not checked.
More on the Ubuntu bugtracker [1].
I'm not aware if an upstream bugreport exists.

Anyway: Using the patch [2] from Ubuntu fixes my use case and the segfaults are gone.

[1] https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1884809
[2] https://git.launchpad.net/ubuntu/+source/mysql-8.0/plain/debian/patches/charset_file_crash.patch
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-19 10:37:24 UTC
Thank you for sharing the Ubuntu bug.
Comment 8 Larry the Git Cow gentoo-dev 2020-08-19 10:37:37 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=381aa46351b1d3d78dd3af10dd0bdc6c844ff70a

commit 381aa46351b1d3d78dd3af10dd0bdc6c844ff70a
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-08-19 10:35:35 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-08-19 10:37:04 +0000

    dev-db/mysql-connector-c: survive malformed charset files
    
    Bug: https://bugs.gentoo.org/737002
    Package-Manager: Portage-3.0.3, Repoman-3.0.0
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 ...ctor-c-8.0.21-survive-malformed-charset-files.patch | 18 ++++++++++++++++++
 ....0.21.ebuild => mysql-connector-c-8.0.21-r1.ebuild} |  1 +
 2 files changed, 19 insertions(+)
Comment 9 Tomáš Mózes 2020-08-19 13:54:24 UTC
Thanks Peter and Thomas, glad it's working.