Bug 242914 - databases/mariadb104-server: mysqld --help --verbose crashes (upstream: MDEV-15795)
Summary: databases/mariadb104-server: mysqld --help --verbose crashes (upstream: MDEV-...
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Bernard Spil
URL: https://jira.mariadb.org/browse/MDEV-...
Keywords: needs-patch, needs-qa
Depends on:
Reported: 2019-12-27 16:31 UTC by Wouter Oosterveld
Modified: 2020-07-25 07:08 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (brnrd)
koobs: merge-quarterly?


Note You need to log in before you can comment on or make changes to this bug.
Description Wouter Oosterveld 2019-12-27 16:31:55 UTC
If you run mysqld of mariadb104-server with options --help and --verbose it crashes with SIGSEGV or SIGILL (seen both).


# /usr/local/libexec/mysqld --help --verbose
2019-12-27 16:52:16 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-12-27 16:52:16 0 [Warning] Could not open mysql.plugin table. Some options may be missing from the help text
/usr/local/libexec/mysqld  Ver 10.4.11-MariaDB for FreeBSD12.0 on amd64 (FreeBSD Ports)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Starts the MariaDB database server.

Usage: /usr/local/libexec/mysqld [OPTIONS]

Default options are read from the following files in the given order:
/usr/local/etc/my.cnf /usr/local/etc/mysql/my.cnf ~/.my.cnf 
The following groups are read: mysqld server mysqld-10.4 mariadb mariadb-10.4 mariadbd mariadbd-10.4 client-server galera
The following options may be given as the first argument:
--print-defaults          Print the program argument list and exit.
--no-defaults             Don't read default options from any option file.
The following specify which files/extra groups are read (specified before remaining options):
--defaults-file=#         Only read default options from the given file #.
--defaults-extra-file=#   Read this file after the global files are read.
--defaults-group-suffix=# Additionally read default groups with # appended as a suffix.
wsrep-slave-FK-checks                                      TRUE
wsrep-slave-UK-checks                                      FALSE
wsrep-slave-threads                                        1
wsrep-sst-auth                                             (No default value)
wsrep-sst-donor-rejects-queries                            FALSE
wsrep-sst-method                                           rsync
wsrep-sst-receive-address                                  AUTO
wsrep-start-position                                       00000000-0000-0000-0000-000000000000:-1
wsrep-sync-wait                                            0
wsrep-trx-fragment-size                                    0
wsrep-trx-fragment-unit                                    bytes

To see what variables a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'.
Illegal instruction (core dumped)


This is a known issue upstream: https://jira.mariadb.org/browse/MDEV-15795

Fix is to remove a line from mysys/thr_timer.c:

# cat files/patch-mysys_thr__timer.c 
--- mysys/thr_timer.c.orig	2019-12-27 15:39:16 UTC
+++ mysys/thr_timer.c
@@ -85,7 +85,6 @@ my_bool init_thr_timer(uint alloc_timers)
   /* Create a thread to handle timers */
-  pthread_attr_setstacksize(&thr_attr,8196);
   thr_timer_inited= 1;
   if (mysql_thread_create(key_thread_timer, &timer_thread, &thr_attr,
                           timer_handler, NULL))
Comment 1 VVD 2020-06-25 12:21:23 UTC
Why not just add this patch?
Upstream is so slooooow…
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2020-07-20 07:13:47 UTC
What other MariaDB port versions are affected?

Can you please also include the proposed patch as an attachment

Comment 3 VVD 2020-07-20 07:39:52 UTC
(In reply to Kubilay Kocak from comment #2)
> What other MariaDB port versions are affected?
I think all.

> Can you please also include the proposed patch as an attachment
Patch for port or patch for file mysys/thr_timer.c?
Comment 4 Bernard Spil freebsd_committer 2020-07-24 18:48:46 UTC
(In reply to VVD from comment #1)
Sorry, so am I... (sooo slooow...)

This patch, does it solve the issue? MDEV-16264
Comment 5 VVD 2020-07-25 07:08:34 UTC
(In reply to Bernard Spil from comment #4)
Look like it fixed in 10.5 already:
-  pthread_attr_setstacksize(&thr_attr,8196);
+  pthread_attr_setstacksize(&thr_attr,64*1024);

10.4 and 10.3 - didn't fixed.

IMHO, Dimov Vasil from https://jira.mariadb.org/browse/MDEV-15795 is right:
> Why is `pthread_attr_setstacksize(&thr_attr,8196);` needed in the first place? I guess the fix of this bug is to just remove it. Capping the stack without a mechanism to catch overflow in a useful way leads to hard to diagnose crashes.

But you can use same patch with increase stack size from 8 to 64k for older mariadb versions too.