[Mono-list] multi-threading operation on Oracle database led to program crash !!!

Veerapuram Varadhan vvaradhan at novell.com
Tue Nov 3 15:03:54 EST 2009


On Tue, 2009-11-03 at 14:55 -0500, Miguel de Icaza wrote:
> Hello,
> 
> > I used Mono+System.Data.OracleClient+instantclient to access Oracle database
> > in multi-threading way on x64bit SUSE Linux. 
> 
> It would be useful to have a test case to reproduce this issue.
> 

Sample repro can be found here:
https://bugzillafiles.novell.org/attachment.cgi?id=170208 

Thanks,

V. Varadhan

> > 
> > Your reply will be highly appreciated!
> > 
> > My program run several minutes and crashed and exited with following
> > message:
> > 
> > Stacktrace:
> > 
> > 
> > Native stacktrace:
> > 
> >         mono(mono_handle_native_sigsegv+0xb0) [0x48c230]
> >         mono(mono_arch_handle_altstack_exception+0xf5) [0x4bbf55]
> >         /lib64/libpthread.so.0 [0x2aed9a374c10]
> >         /opt/oracle/oradb/home/lib/libclntsh.so(kpcsncharset2ucs2+0x2b)
> > [0x2aaaac9788e3]
> >         /opt/oracle/oradb/home/lib/libclntsh.so(OCICharSetToUnicode+0x9)
> > [0x2aaaac8a6a93]
> >         [0x40adf508]
> > 
> > Debug info from gdb:
> > 
> > Using host libthread_db library "/lib64/libthread_db.so.1".
> > [Thread debugging using libthread_db enabled]
> > [New Thread 47199987718976 (LWP 18957)]
> > [New Thread 1102186816 (LWP 18971)]
> > [New Thread 1100085568 (LWP 18970)]
> > [New Thread 1097984320 (LWP 18969)]
> > [New Thread 1091615040 (LWP 18966)]
> > [New Thread 1089448256 (LWP 18965)]
> > [New Thread 1084852544 (LWP 18963)]
> > [New Thread 1082751296 (LWP 18962)]
> > [New Thread 1080584512 (LWP 18961)]
> > [New Thread 1078483264 (LWP 18960)]
> > [New Thread 1075988800 (LWP 18959)]
> > [New Thread 1073887552 (LWP 18958)]
> > 0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> >   12 Thread 1073887552 (LWP 18958)  0x00002aed9a374231 in fmod () from
> > /lib64/libpthread.so.0
> >   11 Thread 1075988800 (LWP 18959)  0x00002aed9a372dfd in sem_wait () from
> > /lib64/libpthread.so.0
> >   10 Thread 1078483264 (LWP 18960)  0x00002aed9a685fcb in fmod () from
> > /lib64/libc.so.6
> >   9 Thread 1080584512 (LWP 18961)  0x00002aed9a3711c6 in
> > pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
> >   8 Thread 1082751296 (LWP 18962)  0x00002aed9a373b8b in fmod () from
> > /lib64/libpthread.so.0
> >   7 Thread 1084852544 (LWP 18963)  0x00002aed9a37394b in fmod () from
> > /lib64/libpthread.so.0
> >   6 Thread 1089448256 (LWP 18965)  0x00002aed9a3711c6 in
> > pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
> >   5 Thread 1091615040 (LWP 18966)  0x00002aed9a693b68 in fmod () from
> > /lib64/libc.so.6
> >   4 Thread 1097984320 (LWP 18969)  0x00002aed9a3711c6 in
> > pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
> >   3 Thread 1100085568 (LWP 18970)  0x00002aed9a3711c6 in
> > pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
> >   2 Thread 1102186816 (LWP 18971)  0x00002aed9a3711c6 in
> > pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
> >   1 Thread 47199987718976 (LWP 18957)  0x00002aed9a3711c6 in
> > pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
> > 
> > Thread 12 (Thread 1073887552 (LWP 18958)):
> > #0  0x00002aed9a374231 in fmod () from /lib64/libpthread.so.0
> > #1  0x000000000055dcaf in collection_thread (unused=<value optimized out>)
> > at collection.c:34
> > #2  0x00002aed9a36d143 in start_thread () from /lib64/libpthread.so.0
> > #3  0x00002aed9a69374d in clone () from /lib64/libc.so.6
> > #4  0x0000000000000000 in ?? ()
> > 
> > Thread 11 (Thread 1075988800 (LWP 18959)):
> > #0  0x00002aed9a372dfd in sem_wait () from /lib64/libpthread.so.0
> > #1  0x00000000004ef998 in finalizer_thread (unused=<value optimized out>) at
> > gc.c:1058
> > #2  0x000000000050ec6c in start_wrapper (data=<value optimized out>) at
> > threads.c:623
> > #3  0x00000000005773b3 in thread_start_routine (args=0x7dc560) at
> > threads.c:286
> > #4  0x0000000000593192 in GC_start_routine (arg=<value optimized out>) at
> > pthread_support.c:1382
> > #5  0x00002aed9a36d143 in start_thread () from /lib64/libpthread.so.0
> > #6  0x00002aed9a69374d in clone () from /lib64/libc.so.6
> > #7  0x0000000000000000 in ?? ()
> > 
> > Thread 10 (Thread 1078483264 (LWP 18960)):
> > #0  0x00002aed9a685fcb in fmod () from /lib64/libc.so.6
> > #1  0x000000004027f625 in ?? ()
> > #2  0x00000000009820d0 in ?? ()
> > #3  0x00002aaaaaadb4c8 in ?? ()
> > #4  0x00002aaaab5f9000 in ?? ()
> > #5  0x0000000000000020 in ?? ()
> > #6  0x0000000040485068 in ?? ()
> > #7  0x0000000040484fc0 in ?? ()
> > #8  0x0000000040484f00 in ?? ()
> > #9  0x00002aaaaaadb4c8 in ?? ()
> > #10 0x00002aaaab5f9000 in ?? ()
> > #11 0x0000000000000020 in ?? ()
> > #12 0x00002aaaab1e8ca0 in ?? ()
> > #13 0x000000004027f4d0 in ?? ()
> > #14 0x0000000000000004 in ?? ()
> > #15 0x00002aaaab1e8ca0 in ?? ()
> > #16 0x0000000000000000 in ?? ()
> > 
> > Thread 9 (Thread 1080584512 (LWP 18961)):
> > #0  0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> > #1  0x0000000000562b0a in _wapi_handle_timedwait_signal_handle
> > (handle=0x40d, timeout=0x0, alertable=1, poll=0)
> >     at handles.c:1605
> > #2  0x0000000000579fc0 in WaitForSingleObjectEx (handle=0x40d,
> > timeout=4294967295, alertable=1) at wait.c:205
> > #3  0x000000000050c6b3 in
> > ves_icall_System_Threading_WaitHandle_WaitOne_internal (this=<value
> > optimized out>, handle=0x40d,
> >     ms=-1, exitContext=<value optimized out>) at threads.c:1446
> > #4  0x000000004028353e in ?? ()
> > #5  0x0000000000a1ccc0 in ?? ()
> > #6  0x000018aeea14452c in ?? ()
> > #7  0x0000000000000000 in ?? ()
> > 
> > Thread 8 (Thread 1082751296 (LWP 18962)):
> > #0  0x00002aed9a373b8b in fmod () from /lib64/libpthread.so.0
> > #1  0x0000000000574034 in _wapi_accept (fd=6, addr=0x0, addrlen=0x0) at
> > sockets.c:209
> > #2  0x0000000000516b33 in
> > ves_icall_System_Net_Sockets_Socket_Accept_internal (sock=6,
> > error=0x40896e7c,
> >     blocking=<value optimized out>) at socket-io.c:892
> > #3  0x0000000040a9904e in ?? ()
> > #4  0x000000000087ec90 in ?? ()
> > #5  0x00002aaaaaadb198 in ?? ()
> > #6  0x0000000000000000 in ?? ()
> > 
> > Thread 7 (Thread 1084852544 (LWP 18963)):
> > #0  0x00002aed9a37394b in fmod () from /lib64/libpthread.so.0
> > #1  0x000000000048c3a3 in mono_handle_native_sigsegv (signal=<value
> > optimized out>, ctx=<value optimized out>)
> >     at /usr/include/bits/unistd.h:35
> > #2  0x00000000004bbf55 in mono_arch_handle_altstack_exception
> > (sigctx=0x2aaaab649c40, fault_addr=<value optimized out>,
> >     stack_ovf=0) at exceptions-amd64.c:910
> > #3  <signal handler called>
> > #4  0x00002aaaac9788e3 in kpcsncharset2ucs2 () from
> > /opt/oracle/oradb/home/lib/libclntsh.so
> > #5  0x00002aaaac8a6a93 in OCICharSetToUnicode () from
> > /opt/oracle/oradb/home/lib/libclntsh.so
> > #6  0x0000000040adf508 in ?? ()
> > #7  0x0000000000874de0 in ?? ()
> > #8  0x00002aaaae9969f0 in ?? ()
> > #9  0x0000000040a97bfc in ?? ()
> > #10 0x00002aaaaed27000 in ?? ()
> > #11 0x00002aaaabcc4260 in ?? ()
> > #12 0x0000000000000000 in ?? ()
> > 
> > Thread 6 (Thread 1089448256 (LWP 18965)):
> > #0  0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> > #1  0x0000000000562b0a in _wapi_handle_timedwait_signal_handle
> > (handle=0x401, timeout=0x0, alertable=1, poll=0)
> >     at handles.c:1605
> > #2  0x0000000000579fc0 in WaitForSingleObjectEx (handle=0x401,
> > timeout=4294967295, alertable=1) at wait.c:205
> > #3  0x0000000000513121 in async_invoke_thread (data=0x0) at
> > threadpool.c:1424
> > #4  0x000000000050ec6c in start_wrapper (data=<value optimized out>) at
> > threads.c:623
> > #5  0x00000000005773b3 in thread_start_routine (args=0x7dcf88) at
> > threads.c:286
> > #6  0x0000000000593192 in GC_start_routine (arg=<value optimized out>) at
> > pthread_support.c:1382
> > #7  0x00002aed9a36d143 in start_thread () from /lib64/libpthread.so.0
> > #8  0x00002aed9a69374d in clone () from /lib64/libc.so.6
> > #9  0x0000000000000000 in ?? ()
> > 
> > Thread 5 (Thread 1091615040 (LWP 18966)):
> > #0  0x00002aed9a693b68 in fmod () from /lib64/libc.so.6
> > #1  0x0000000000511d34 in socket_io_epoll_main (p=<value optimized out>) at
> > threadpool.c:600
> > #2  0x000000000050ec6c in start_wrapper (data=<value optimized out>) at
> > threads.c:623
> > #3  0x00000000005773b3 in thread_start_routine (args=0x7dd1e0) at
> > threads.c:286
> > #4  0x0000000000593192 in GC_start_routine (arg=<value optimized out>) at
> > pthread_support.c:1382
> > #5  0x00002aed9a36d143 in start_thread () from /lib64/libpthread.so.0
> > #6  0x00002aed9a69374d in clone () from /lib64/libc.so.6
> > #7  0x0000000000000000 in ?? ()
> > 
> > Thread 4 (Thread 1097984320 (LWP 18969)):
> > #0  0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> > #1  0x0000000000562b0a in _wapi_handle_timedwait_signal_handle
> > (handle=0x401, timeout=0x0, alertable=1, poll=0)
> >     at handles.c:1605
> > #2  0x0000000000579fc0 in WaitForSingleObjectEx (handle=0x401,
> > timeout=4294967295, alertable=1) at wait.c:205
> > #3  0x0000000000513121 in async_invoke_thread (data=0x0) at
> > threadpool.c:1424
> > #4  0x000000000050ec6c in start_wrapper (data=<value optimized out>) at
> > threads.c:623
> > #5  0x00000000005773b3 in thread_start_routine (args=0x7dd5c8) at
> > threads.c:286
> > #6  0x0000000000593192 in GC_start_routine (arg=<value optimized out>) at
> > pthread_support.c:1382
> > #7  0x00002aed9a36d143 in start_thread () from /lib64/libpthread.so.0
> > #8  0x00002aed9a69374d in clone () from /lib64/libc.so.6
> > #9  0x0000000000000000 in ?? ()
> > 
> > Thread 3 (Thread 1100085568 (LWP 18970)):
> > #0  0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> > #1  0x0000000000562b0a in _wapi_handle_timedwait_signal_handle
> > (handle=0x401, timeout=0x0, alertable=1, poll=0)
> >     at handles.c:1605
> > #2  0x0000000000579fc0 in WaitForSingleObjectEx (handle=0x401,
> > timeout=4294967295, alertable=1) at wait.c:205
> > #3  0x0000000000513121 in async_invoke_thread (data=0x0) at
> > threadpool.c:1424
> > #4  0x000000000050ec6c in start_wrapper (data=<value optimized out>) at
> > threads.c:623
> > #5  0x00000000005773b3 in thread_start_routine (args=0x7dd8e8) at
> > threads.c:286
> > #6  0x0000000000593192 in GC_start_routine (arg=<value optimized out>) at
> > pthread_support.c:1382
> > #7  0x00002aed9a36d143 in start_thread () from /lib64/libpthread.so.0
> > #8  0x00002aed9a69374d in clone () from /lib64/libc.so.6
> > #9  0x0000000000000000 in ?? ()
> > 
> > Thread 2 (Thread 1102186816 (LWP 18971)):
> > #0  0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> > #1  0x0000000000562b0a in _wapi_handle_timedwait_signal_handle
> > (handle=0x401, timeout=0x0, alertable=1, poll=0)
> >     at handles.c:1605
> > #2  0x0000000000579fc0 in WaitForSingleObjectEx (handle=0x401,
> > timeout=4294967295, alertable=1) at wait.c:205
> > #3  0x0000000000513121 in async_invoke_thread (data=0x0) at
> > threadpool.c:1424
> > #4  0x000000000050ec6c in start_wrapper (data=<value optimized out>) at
> > threads.c:623
> > #5  0x00000000005773b3 in thread_start_routine (args=0x7dd9b0) at
> > threads.c:286
> > #6  0x0000000000593192 in GC_start_routine (arg=<value optimized out>) at
> > pthread_support.c:1382
> > #7  0x00002aed9a36d143 in start_thread () from /lib64/libpthread.so.0
> > #8  0x00002aed9a69374d in clone () from /lib64/libc.so.6
> > #9  0x0000000000000000 in ?? ()
> > 
> > Thread 1 (Thread 47199987718976 (LWP 18957)):
> > #0  0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> > #1  0x0000000000562b0a in _wapi_handle_timedwait_signal_handle
> > (handle=0x400, timeout=0x0, alertable=1, poll=0)
> >     at handles.c:1605
> > #2  0x000000000057aa1d in WaitForMultipleObjectsEx (numobjects=3,
> > handles=0x2aaaab710ed0, waitall=0, timeout=4294967295,
> >     alertable=0) at wait.c:723
> > #3  0x000000000050ff01 in mono_thread_manage () at threads.c:2497
> > #4  0x0000000000473153 in mono_main (argc=2, argv=<value optimized out>) at
> > driver.c:1648
> > #5  0x00002aed9a5f1154 in __libc_start_main () from /lib64/libc.so.6
> > #6  0x0000000000422139 in _start ()
> > #0  0x00002aed9a3711c6 in pthread_cond_wait@@GLIBC_2.3.2 () from
> > /lib64/libpthread.so.0
> > 
> > =================================================================
> > Got a SIGSEGV while executing native code. This usually indicates
> > a fatal error in the mono runtime or one of the native libraries
> > used by your application.
> > =================================================================
> > 
> > Aborted
> > 
> > 
> > 
> > 
> > 
> > I wrote following code:
> > 
> > using System;
> > using System.Net.Sockets;
> > using System.Threading;
> > 
> > //using some my namespace
> > 
> > namespace CommandAgent
> > {
> > 	class MainClass
> > 	{
> > 		public static void Main(string[] args)
> > 		{
> > 		
> > 			SchemaServer schemaServer=new SchemaServer();
> > 			Thread threadServer=new Thread(new ThreadStart(schemaServer.Procedure));
> > 			threadServer.Start();	
> > 					
> > 			Thread threadPoll=new Thread(new ThreadStart(SchemaPoll.Procedure));
> > 			threadPoll.Start();	
> > 			
> > 			
> > 		}
> > 	}
> > 	
> > 	public class SchemaServer
> > 	{
> > 		public SchemaServer()
> > 		{
> > 		}	
> > 		public void Procedure()
> > 		{
> > 			while(true)
> > 			{
> > 				//do something
> > 			}			
> > 		}
> > 	}
> > 	
> > 	public class SchemaPoll
> > 	{
> > 		public static void Procedure()
> > 		{
> > 			while(true)
> > 			{
> > 				try
> > 				{
> > 					//CommandInvoker.Invoke() method is used to scan oracle database table
> > to retrieve some data
> > 					CommandInvoker.Invoke();						
> > 					Thread.Sleep(5000);
> > 					//CommandFeeder.Feed() method is used to scan oracle database table to
> > retrieve some data
> > 					CommandFeeder.Feed();		
> > 				}
> > 				catch(Exception ex)
> > 				{
> > 					Console.WriteLine("Exception in SchemaPoll.Procedure:{0}",ex.Message);
> > 				}
> > 			}			
> > 		}
> > 	}
> > 	
> > }
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list