Bug #1225 mysqld crash on startup
Submitted: 8 Sep 2003 10:22 Modified: 17 Nov 2003 1:37
Reporter: Martin Mokrejs Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.15-bk OS:Linux (Linux 2.4.22-pre7)
Assigned to: CPU Architecture:Any

[8 Sep 2003 10:22] Martin Mokrejs
Description:
/usr/local/mysql-bk/libexec/mysqld --defaults-extra-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql --skip-locking --open-files-limit=30000
Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line
Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=134217728
read_buffer_size=1044480
max_used_connections=0
max_connections=100
threads_connected=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 437871 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x8252938
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfffec38, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:

0x80ed3be handle_segfault + 478
0x4003803c _end + 937391388
0x40033bb2 _end + 937373842
0x81dde22 safe_mutex_lock + 23
0x81dc923 thr_lock + 149
0x81dd29c thr_multi_lock + 169
0x80e916b _Z17mysql_lock_tablesP3THDPP8st_tablej + 155
0x813f35d _Z8acl_initP3THDb + 621
0x80ee3b4 main + 2772
0x401da7a7 _end + 939105415
0x80a1401 _start + 33

New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://www.mysql.com/doc/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do 
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at (nil)  is invalid pointer
thd->thread_id=0
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.

# vmstat  
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 2  0      0  22924  84152 656076    0    0    16     4  113    68 98  1  1  0
#

How to repeat:
The binary was installed on Sep  4 00:37 /usr/local/mysql-bk/libexec/mysqld GMT+1 time.
[9 Sep 2003 4:32] Martin Mokrejs
I tried current BK tree:

(gdb) 
my_open (FileName=0x8253d28 "./mysql/host.MYD", Flags=9, MyFlags=16) at my_open.c:62
62      } /* my_open */
(gdb) 
0x08198979 in mi_open_datafile ()
(gdb) 
Single stepping until exit from function mi_open_datafile, 
which has no line number information.
0x08196b90 in mi_open ()
(gdb) 
Single stepping until exit from function mi_open, 
which has no line number information.
thr_lock_init (lock=0x82539f4) at thr_lock.c:307
307       DBUG_ENTER("thr_lock_init");
(gdb) 
_db_enter_ (_func_=0xbfffc4f4 "\002", _file_=0xbfffc4f4 "\002", _line_=3221210356, _sfunc_=0xbfffc4f4, _sfile_=0xbfffc4f4, 
    _slevel_=0xbfffc4f4, _sframep_=0xbfffc500) at dbug.c:706
706       if (!_no_db_)
(gdb) 
708         int save_errno=errno;
(gdb) 
715         if (!(state=code_state()))
(gdb) 
code_state () at dbug.c:351
351       CODE_STATE *state=0;
(gdb) 
352       struct st_my_thread_var *tmp=my_thread_var;
(gdb) 
_my_thread_var () at my_thr_init.c:204
204       struct st_my_thread_var *tmp=
(gdb) 
215     }
(gdb) 
code_state () at dbug.c:353
353       if (tmp)
(gdb) 
355         if (!(state=(CODE_STATE *) tmp->dbug))
(gdb) 
365     }

[cut]

_db_return_ (_line_=3221210288, _sfunc_=0xbfffc4b0, _sfile_=0xbfffc4b0, _slevel_=0xbfffc4b8) at dbug.c:795
795       if (!_no_db_)
(gdb) 
797         int save_errno=errno;
(gdb) 
798         if (!(state=code_state()))
(gdb) 
code_state () at dbug.c:351
351       CODE_STATE *state=0;
(gdb) 
352       struct st_my_thread_var *tmp=my_thread_var;
(gdb) 
_my_thread_var () at my_thr_init.c:204
204       struct st_my_thread_var *tmp=
(gdb) 
215     }
(gdb) 
code_state () at dbug.c:353
353       if (tmp)
(gdb) 
355         if (!(state=(CODE_STATE *) tmp->dbug))
(gdb) 
365     }
(gdb) 
_db_return_ (_line_=136577736, _sfunc_=0x82402c8, _sfile_=0x82402c8, _slevel_=0xbfffc4b8) at dbug.c:800
800         if (!init_done)
(gdb) 
802         if (stack->flags & (TRACE_ON | DEBUG_ON | PROFILE_ON))
(gdb) 
829         state->level = *_slevel_-1;
(gdb) 
830         state->func = *_sfunc_;
(gdb) 
831         state->file = *_sfile_;
(gdb) l
826           }
827           dbug_flush(state);
828         }
829         state->level = *_slevel_-1;
830         state->func = *_sfunc_;
831         state->file = *_sfile_;
832     #ifndef THREAD
833         if (state->framep != NULL)
834           state->framep = (char **) *state->framep;
835     #endif
(gdb) s
836         errno=save_errno;
(gdb) 
838     }
(gdb) 
list_add (root=0x0, element=0x82539f4) at list.c:43
43      }
(gdb) 
thr_lock_init (lock=0x82539f4) at thr_lock.c:318
318       pthread_mutex_unlock(&THR_LOCK_lock);
(gdb) 
safe_mutex_unlock (mp=0x823f8c0, file=0x821d3c1 "thr_lock.c", line=318) at thr_mutex.c:130
130       pthread_mutex_lock(&mp->global);
(gdb) 
131       if (mp->count == 0)
(gdb) 
138       if (!pthread_equal(pthread_self(),mp->thread))
(gdb) 
145       mp->count--;
(gdb) 
150       error=pthread_mutex_unlock(&mp->mutex);
(gdb) 
151       if (error)
(gdb) 
158       pthread_mutex_unlock(&mp->global);
(gdb) 
160     }
(gdb) 
thr_lock_init (lock=0x82539f4) at thr_lock.c:319
319       DBUG_VOID_RETURN;
(gdb) 
_db_return_ (_line_=3221210356, _sfunc_=0xbfffc4f4, _sfile_=0xbfffc4f4, _slevel_=0xbfffc4fc) at dbug.c:795
795       if (!_no_db_)
(gdb) 
797         int save_errno=errno;
(gdb) 
798         if (!(state=code_state()))
(gdb) 
code_state () at dbug.c:351
351       CODE_STATE *state=0;
(gdb) 
352       struct st_my_thread_var *tmp=my_thread_var;
(gdb) 
_my_thread_var () at my_thr_init.c:204
204       struct st_my_thread_var *tmp=
(gdb) 
215     }
(gdb) 
code_state () at dbug.c:353
353       if (tmp)
(gdb) 
355         if (!(state=(CODE_STATE *) tmp->dbug))
(gdb) 
365     }
(gdb) 
_db_return_ (_line_=136577736, _sfunc_=0x82402c8, _sfile_=0x82402c8, _slevel_=0xbfffc4fc) at dbug.c:800
800         if (!init_done)
(gdb) 
802         if (stack->flags & (TRACE_ON | DEBUG_ON | PROFILE_ON))
(gdb) 
829         state->level = *_slevel_-1;
(gdb) 
830         state->func = *_sfunc_;
(gdb) 
831         state->file = *_sfile_;
(gdb) 
836         errno=save_errno;
(gdb) 
838     }
(gdb) 
thr_lock_init (lock=0x82539f4) at thr_lock.c:320
320     }
(gdb) 
0x08196cb0 in mi_open ()
(gdb) l
315       pthread_mutex_lock(&THR_LOCK_lock);           /* Add to locks in use */
316       lock->list.data=(void*) lock;
317       thread_list=list_add(thread_list,&lock->list);
318       pthread_mutex_unlock(&THR_LOCK_lock);
319       DBUG_VOID_RETURN;
320     }
321
322
323     void thr_lock_delete(THR_LOCK *lock)
324     {
(gdb) s
Single stepping until exit from function mi_open, 
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x40036eeb in pthread_rwlock_init () from /lib/libpthread.so.0
(gdb) where
#0  0x40036eeb in pthread_rwlock_init () from /lib/libpthread.so.0
#1  0x08196d8f in mi_open ()
#2  0x08155378 in ha_myisam::open(char const*, int, unsigned) ()
#3  0x081534e9 in handler::ha_open(char const*, int, int) ()
#4  0x08116a18 in openfrm(char const*, char const*, unsigned, unsigned, unsigned, st_table*) ()
#5  0x0811580d in open_unireg_entry(THD*, st_table*, char const*, char const*, char const*) ()
#6  0x0811276e in open_table(THD*, char const*, char const*, char const*, bool*) ()
#7  0x08113584 in open_tables(THD*, st_table_list*) ()
#8  0x0813f3df in acl_init(THD*, bool) ()
#9  0x080ee3b4 in main ()
#10 0x401da7a7 in __libc_start_main () from /lib/libc.so.6
(gdb)
[9 Sep 2003 4:41] Martin Mokrejs
Starting program: /usr/local/mysql-bk/libexec/mysqld --defaults-extra-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql --skip-locking --open-files-limit=30000
[New Thread 16384 (LWP 26297)]
Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line
Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line
[New Thread 32769 (LWP 26298)]
[New Thread 16386 (LWP 26299)]
[Switching to Thread 16384 (LWP 26297)]

Breakpoint 4, thr_lock_init (lock=0x82539f4) at thr_lock.c:320
320     }
(gdb) l
315       pthread_mutex_lock(&THR_LOCK_lock);           /* Add to locks in use */
316       lock->list.data=(void*) lock;
317       thread_list=list_add(thread_list,&lock->list);
318       pthread_mutex_unlock(&THR_LOCK_lock);
319       DBUG_VOID_RETURN;
320     }
321
322
323     void thr_lock_delete(THR_LOCK *lock)
324     {
(gdb) p THR_LOCK_lock
$4 = {global = {__m_reserved = 0, __m_count = 0, __m_owner = 0x0, __m_kind = 0, __m_lock = {__status = 0, __spinlock = 0}}, mutex = {
    __m_reserved = 0, __m_count = 0, __m_owner = 0x0, __m_kind = 3, __m_lock = {__status = 0, __spinlock = 0}}, 
  file = 0x821d3c1 "thr_lock.c", line = 315, count = 0, thread = 16384}
(gdb) p &THR_LOCK_lock
$5 = (safe_mutex_t *) 0x823f8c0
(gdb) s
0x08196cb0 in mi_open ()
(gdb) l
325       DBUG_ENTER("thr_lock_delete");
326       VOID(pthread_mutex_destroy(&lock->mutex));
327       pthread_mutex_lock(&THR_LOCK_lock);
328       thread_list=list_delete(thread_list,&lock->list);
329       pthread_mutex_unlock(&THR_LOCK_lock);
330       DBUG_VOID_RETURN;
331     }
332
333             /* Initialize a lock instance */
334
(gdb) s
Single stepping until exit from function mi_open, 
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x40036eeb in pthread_rwlock_init () from /lib/libpthread.so.0
(gdb) where
#0  0x40036eeb in pthread_rwlock_init () from /lib/libpthread.so.0
#1  0x08196d8f in mi_open ()
#2  0x08155378 in ha_myisam::open(char const*, int, unsigned) ()
#3  0x081534e9 in handler::ha_open(char const*, int, int) ()
#4  0x08116a18 in openfrm(char const*, char const*, unsigned, unsigned, unsigned, st_table*) ()
#5  0x0811580d in open_unireg_entry(THD*, st_table*, char const*, char const*, char const*) ()
#6  0x0811276e in open_table(THD*, char const*, char const*, char const*, bool*) ()
#7  0x08113584 in open_tables(THD*, st_table_list*) ()
#8  0x0813f3df in acl_init(THD*, bool) ()
#9  0x080ee3b4 in main ()
#10 0x401da7a7 in __libc_start_main () from /lib/libc.so.6
(gdb) 

vrapenec mysql-4.0 # ls -la /lib/libpthread*   
-rwxr-xr-x    1 root     root        91538 Jul 22 15:03 /lib/libpthread-0.10.so
lrwxrwxrwx    1 root     root           18 Jul 22 15:03 /lib/libpthread.so.0 -> libpthread-0.10.so
vrapenec mysql-4.0 # ls -la /lib/libc*
-rwxr-xr-x    1 root     root      1466302 Jul 22 15:03 /lib/libc-2.3.2.so
lrwxrwxrwx    1 root     root           13 Jul 22 15:03 /lib/libc.so.6 -> libc-2.3.2.so
[cut]

I use gentoo linux.

*  sys-libs/glibc
      Latest version available: 2.3.2-r1
      Latest version installed: 2.3.2-r1
      Size of downloaded files: 13,417 kB
      Homepage:    http://www.gnu.org/software/libc/libc.html
      Description: GNU libc6 (also called glibc2) C library
[20 Oct 2003 16:40] Alexander Keremidarski
Martin,

Can you try repeating this problem with 4.0.16 ?
[17 Nov 2003 1:37] Alexander Keremidarski
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.