Bug #48094 Crash on shutdown
Submitted: 15 Oct 2009 18:56 Modified: 15 Nov 2009 19:00
Reporter: Vladislav Vaintroub Email Updates:
Status: No Feedback Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1-mtr OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: sporadic

[15 Oct 2009 18:56] Vladislav Vaintroub
When running mtr test suite, I get a crash on mysql shutdown from tiem to time.

The access violation is in ntdll.dll and comes from EnterCriticalSection within pthread_cond_timedwait. It suggests that CRITICAL_SECTION is invalid (maybe already destroyed)?

the callstacks at the moment of the crash

Crashing thread (handle manager):

 	ntdll.dll!_RtlpWaitOnCriticalSection@8()  + 0x99 bytes	
 	ntdll.dll!_RtlEnterCriticalSection@4()  + 0x168e8 bytes	
>	mysqld.exe!pthread_cond_timedwait(pthread_cond_t * cond=0x0181c374, _RTL_CRITICAL_SECTION * mutex=0x0181c358, timespec * abstime=0x02fafc24)  Line 127	C
 	mysqld.exe!handle_manager(void * arg=0x00000000)  Line 90 + 0x14 bytes	C++
 	mysqld.exe!pthread_start(void * param=0x00e03ab0)  Line 85 + 0x3 bytes	C
 	mysqld.exe!_callthreadstart()  Line 293 + 0x6 bytes	C
 	mysqld.exe!_threadstart(void * ptd=0x00e295a0)  Line 275 + 0x5 bytes	C
 	kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes	
 	ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes	
 	ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes

Main thread:
 	kernel32.dll!_WaitForMultipleObjects@16()  + 0x18 bytes	
 	mysqld.exe!pthread_cond_timedwait(pthread_cond_t * cond=0x0182bba0, _RTL_CRITICAL_SECTION * mutex=0x0182bb40, timespec * abstime=0x002df74c)  Line 126	C
>	mysqld.exe!my_thread_global_end()  Line 180 + 0x14 bytes	C
 	mysqld.exe!my_end(int infoflag=0)  Line 236	C
 	mysqld.exe!win_main(int argc=10, char * * argv=0x00ac3638)  Line 4529 + 0x14 bytes	C++
 	mysqld.exe!mysql_service(void * p=0x00000000)  Line 4549 + 0x12 bytes	C++
 	mysqld.exe!main(int argc=10, char * * argv=0x00ac3638)  Line 4735 + 0x13 bytes	C++

The code around the crash: 


  result= WaitForMultipleObjects(2, cond->events, FALSE, timeout);
  EnterCriticalSection(&cond->lock_waiting); // <--Crash here

The caller  of the function handle manager() stucks here:

      while ((!error || error == EINTR) && !abort_manager)
        error= pthread_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);

Another thread (main) is in the 
  while (THR_thread_count > 0)
loop in my_thread_global_end()

How to repeat:
switch on Windows Error reporting or Visual Sttudio JIT debugger,
run mtr many times.
[15 Oct 2009 18:58] Vladislav Vaintroub
dont know if it is  important or not, I run mtr with --parallel=10
[15 Oct 2009 19:00] Miguel Solorzano
Which exactly bzr source tree have you tested?. Thanks in advance.
[16 Nov 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".