Commit ce40c2fd authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

--core-file ; To get a core on SIGSEGV when using Linuxthreads

parent 25929faf
...@@ -5896,9 +5896,9 @@ of function} warnings. These may be ignored. ...@@ -5896,9 +5896,9 @@ of function} warnings. These may be ignored.
@node Linux, Alpha-DEC-Unix, SunOS, Source install system issues @node Linux, Alpha-DEC-Unix, SunOS, Source install system issues
@subsection Linux notes (all Linux versions) @subsection Linux notes (all Linux versions)
@strong{MySQL} uses LinuxThreads on Linux. If you are using an old Linux @strong{MySQL} uses LinuxThreads on Linux. If you are using an old
version that doesn't have @code{glibc2}, you must install LinuxThreads before Linux version that doesn't have @code{glibc2}, you must install
trying to compile LinuxThreads before trying to compile
@strong{MySQL}. @uref{http://www.mysql.com/Downloads/Linux} @strong{MySQL}. @uref{http://www.mysql.com/Downloads/Linux}
Note that @code{glibc} versions before and including 2.1.1 has a fatal Note that @code{glibc} versions before and including 2.1.1 has a fatal
...@@ -5969,6 +5969,11 @@ If you see a dead @code{mysqld} daemon process with @code{ps}, this usually ...@@ -5969,6 +5969,11 @@ If you see a dead @code{mysqld} daemon process with @code{ps}, this usually
means that you have found a bug in @strong{MySQL} or you have got a corrupted means that you have found a bug in @strong{MySQL} or you have got a corrupted
table. @xref{Crashing}. table. @xref{Crashing}.
If you want to get a core dump on Linux if mysqld dies with a SIGSEGV
signal, you can start mysqld with the @code{--core-file} option. Note
that you also probably need to raise the @code{core file size} with
@code{ulimit}!
If you are using LinuxThreads and @code{mysqladmin shutdown} doesn't work, If you are using LinuxThreads and @code{mysqladmin shutdown} doesn't work,
you must upgrade to LinuxThreads 0.7.1 or newer. you must upgrade to LinuxThreads 0.7.1 or newer.
...@@ -6165,6 +6170,10 @@ until you have installed @code{glibc} 2.0.7-19 from source! ...@@ -6165,6 +6170,10 @@ until you have installed @code{glibc} 2.0.7-19 from source!
You can check which version of @code{glibc} you have with @code{rpm -q glibc}. You can check which version of @code{glibc} you have with @code{rpm -q glibc}.
Another reason for the above error is if you try to use more threads
than your Linux kernel is configured for. In this case you should rise
the limits in @file{include/linux/tasks.h} and recompile your kernel!
@node Linux-SPARC, Linux-Alpha, Linux-RedHat51, Linux @node Linux-SPARC, Linux-Alpha, Linux-RedHat51, Linux
@subsubsection Linux-SPARC notes @subsubsection Linux-SPARC notes
...@@ -35686,6 +35695,9 @@ though, so 3.23 is not released as a stable version yet. ...@@ -35686,6 +35695,9 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.23 @appendixsubsec Changes in release 3.23.23
@itemize @bullet @itemize @bullet
@item @item
Added option @code{--core-file} to @code{mysqld} to get a core file on
Linux if mysqld dies on the SIGSEGV signal
@item
@strong{MySQL} client 'mysql' now starts with option --no-named-commands @strong{MySQL} client 'mysql' now starts with option --no-named-commands
(-g) by default. This option can be disabled with --enable-named-commands (-g) by default. This option can be disabled with --enable-named-commands
(-G). This may cause incompatibility problems in some cases, for example (-G). This may cause incompatibility problems in some cases, for example
...@@ -40324,6 +40336,9 @@ old threads. You can avoid this problem by starting @code{mysqld} with ...@@ -40324,6 +40336,9 @@ old threads. You can avoid this problem by starting @code{mysqld} with
@code{-O thread_cache_size= 'max_connections +1'}. In most cases just @code{-O thread_cache_size= 'max_connections +1'}. In most cases just
using @code{-O thread_cache_size= 5'} will help a lot! using @code{-O thread_cache_size= 5'} will help a lot!
If you want to get a core dump on Linux if mysqld dies with a SIGSEGV signal,
you can start mysqld with the @code{--core-file} option.
If you are using gdb 4.17.x or above on Linux, you should install a If you are using gdb 4.17.x or above on Linux, you should install a
@file{.gdb} file, with the following information, in your current @file{.gdb} file, with the following information, in your current
directory: directory:
...@@ -127,7 +127,7 @@ void sql_element_free(void *ptr); ...@@ -127,7 +127,7 @@ void sql_element_free(void *ptr);
#define TEST_NO_THREADS 32 /* For debugging under Linux */ #define TEST_NO_THREADS 32 /* For debugging under Linux */
#define TEST_READCHECK 64 /* Force use of readcheck */ #define TEST_READCHECK 64 /* Force use of readcheck */
#define TEST_NO_EXTRA 128 #define TEST_NO_EXTRA 128
#define TEST_KILL_ON_DEBUG 256 /* Kill server */ #define TEST_CORE_ON_SIGNAL 256 /* Give core if signal */
/* options for select set by the yacc parser */ /* options for select set by the yacc parser */
#define SELECT_DISTINCT 1 #define SELECT_DISTINCT 1
......
...@@ -1003,6 +1003,20 @@ static void init_signals(void) ...@@ -1003,6 +1003,20 @@ static void init_signals(void)
} }
#else #else
#ifdef HAVE_LINUXTHREADS
/* Produce a core for the thread */
static sig_handler write_core(int sig)
{
fprintf(stderr,"Got signal %s in thread %d\n",sys_siglist[sig],getpid());
signal(sig, SIG_DFL);
if (fork() != 0) exit(1); // Abort main program
// Core will be written at exit
}
#endif
static void init_signals(void) static void init_signals(void)
{ {
sigset_t set; sigset_t set;
...@@ -1012,6 +1026,16 @@ static void init_signals(void) ...@@ -1012,6 +1026,16 @@ static void init_signals(void)
sigset(THR_KILL_SIGNAL,end_thread_signal); sigset(THR_KILL_SIGNAL,end_thread_signal);
sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called! sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
#ifdef HAVE_LINUXTHREADS
if (test_flags & TEST_CORE_ON_SIGNAL)
{
struct sigaction sa; sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
sa.sa_handler=write_core;
sigaction(SIGSEGV, &sa, NULL);
}
#endif
(void) sigemptyset(&set); (void) sigemptyset(&set);
#ifdef THREAD_SPECIFIC_SIGPIPE #ifdef THREAD_SPECIFIC_SIGPIPE
sigset(SIGPIPE,abort_thread); sigset(SIGPIPE,abort_thread);
...@@ -2134,7 +2158,7 @@ enum options {OPT_ISAM_LOG=256,OPT_SKIP_NEW,OPT_SKIP_GRANT, ...@@ -2134,7 +2158,7 @@ enum options {OPT_ISAM_LOG=256,OPT_SKIP_NEW,OPT_SKIP_GRANT,
OPT_MASTER_PORT, OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY, OPT_MASTER_PORT, OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY,
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES, OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB}; OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB, OPT_WANT_CORE};
static struct option long_options[] = static struct option long_options[] =
{ {
...@@ -2156,6 +2180,7 @@ static struct option long_options[] = ...@@ -2156,6 +2180,7 @@ static struct option long_options[] =
#ifdef __WIN__ #ifdef __WIN__
{"console", no_argument, 0, OPT_CONSOLE}, {"console", no_argument, 0, OPT_CONSOLE},
#endif #endif
{"core-file", no_argument, 0, OPT_WANT_CORE},
{"chroot", required_argument,0, 'r'}, {"chroot", required_argument,0, 'r'},
{"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR}, {"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR},
{"datadir", required_argument, 0, 'h'}, {"datadir", required_argument, 0, 'h'},
...@@ -2189,7 +2214,9 @@ static struct option long_options[] = ...@@ -2189,7 +2214,9 @@ static struct option long_options[] =
{"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE}, {"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE},
{"new", no_argument, 0, 'n'}, {"new", no_argument, 0, 'n'},
{"old-protocol", no_argument, 0, 'o'}, {"old-protocol", no_argument, 0, 'o'},
#ifndef DBUG_OFF
{"one-thread", no_argument, 0, OPT_ONE_THREAD}, {"one-thread", no_argument, 0, OPT_ONE_THREAD},
#endif
{"pid-file", required_argument, 0, (int) OPT_PID_FILE}, {"pid-file", required_argument, 0, (int) OPT_PID_FILE},
{"port", required_argument, 0, 'P'}, {"port", required_argument, 0, 'P'},
{"replicate-do-db", required_argument, 0, OPT_REPLICATE_DO_DB}, {"replicate-do-db", required_argument, 0, OPT_REPLICATE_DO_DB},
...@@ -2432,6 +2459,7 @@ static void usage(void) ...@@ -2432,6 +2459,7 @@ static void usage(void)
--character-sets-dir=...\n\ --character-sets-dir=...\n\
Directory where character sets are\n\ Directory where character sets are\n\
--chroot=path Chroot mysqld daemon during startup\n\ --chroot=path Chroot mysqld daemon during startup\n\
--core-file Write core on errors\n\
-h, --datadir=path Path to the database root"); -h, --datadir=path Path to the database root");
#ifndef DBUG_OFF #ifndef DBUG_OFF
printf("\ printf("\
...@@ -2465,9 +2493,11 @@ static void usage(void) ...@@ -2465,9 +2493,11 @@ static void usage(void)
--pid-file=path Pid file used by safe_mysqld\n\ --pid-file=path Pid file used by safe_mysqld\n\
-P, --port=... Port number to use for connection\n\ -P, --port=... Port number to use for connection\n\
-n, --new Use very new possible 'unsafe' functions\n\ -n, --new Use very new possible 'unsafe' functions\n\
-o, --old-protocol Use the old (3.20) protocol\n\ -o, --old-protocol Use the old (3.20) protocol\n");
#ifndef DBUG_OFF
puts("\
--one-thread Only use one thread (for debugging under Linux)\n"); --one-thread Only use one thread (for debugging under Linux)\n");
/* We have to break the string here because of VC++ limits */ #endif
puts("\ puts("\
-O, --set-variable var=option\n\ -O, --set-variable var=option\n\
Give a variable an value. --help lists variables\n\ Give a variable an value. --help lists variables\n\
...@@ -2729,8 +2759,6 @@ static void get_options(int argc,char **argv) ...@@ -2729,8 +2759,6 @@ static void get_options(int argc,char **argv)
binlog_do_db.push_back(db); binlog_do_db.push_back(db);
break; break;
} }
case (int) OPT_SQL_BIN_UPDATE_SAME: case (int) OPT_SQL_BIN_UPDATE_SAME:
opt_sql_bin_update = 1; opt_sql_bin_update = 1;
break; break;
...@@ -2785,6 +2813,9 @@ static void get_options(int argc,char **argv) ...@@ -2785,6 +2813,9 @@ static void get_options(int argc,char **argv)
case (int) OPT_ONE_THREAD: case (int) OPT_ONE_THREAD:
test_flags |= TEST_NO_THREADS; test_flags |= TEST_NO_THREADS;
break; break;
case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL;
break;
case (int) OPT_BIND_ADDRESS: case (int) OPT_BIND_ADDRESS:
if (optarg && isdigit(optarg[0])) if (optarg && isdigit(optarg[0]))
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment