Bugzilla – Bug 321753
MaxDB client library and SIGSEGV
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by dmitryskey@hotmail.com 2006-08-09 05:50:31 MST ---- I try to run test cases for ADO.NET provider for MaxDB which are working perfectly on .Net (see http://svn.sourceforge.net/viewvc/maxdbprovider/MaxDBConsole/UnitTesting/) the command line is nunit-console /fixture=MaxDB.UnitTesting.CommandTests MaxDB.Test.exe Output is NUnit version 2.2.0 Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole. Copyright (C) 2000-2003 Philip Craig. All Rights Reserved. OS Version: Unix 2.6.8.2 Mono Version: 1.1.4322.2032 ================================================================= 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. ================================================================= Stacktrace: in <0x4> (wrapper managed-to-native) System.Object:__icall_wrapper_g_free (intptr) in <0x6b9d0c> (wrapper managed-to-native) System.Object:__icall_wrapper_g_free (intptr) in <0xffffff19> (wrapper managed-to-native) MaxDB.Data.Utilities.UnsafeNativeMethods:SQLDBC_ErrorHndl_getSQLState (intptr) in <0x31> MaxDB.Data.MaxDBException:ThrowException (string,intptr,System.Exception) in <0xf> MaxDB.Data.MaxDBException:ThrowException (string,intptr) in <0x1b8> MaxDB.Data.MaxDBCommand:BindAndExecute (intptr,MaxDB.Data.MaxDBParameterCollection[]) in <0xb8> MaxDB.Data.MaxDBCommand:ExecuteNonQuery () in <0x3a> MaxDB.UnitTesting.BaseTest:ExecuteNonQuery (string) in <0x19> MaxDB.UnitTesting.BaseTest:DropTestTable () in <0x100> MaxDB.UnitTesting.BaseTest:Init (string) in <0xf> MaxDB.UnitTesting.CommandTests:SetUp () in <0xfef34747> (wrapper runtime-invoke) System.Object:runtime_invoke_void (object,intptr,intptr,intptr) in <0x4> (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[]) in <0x23418d> (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[]) in <0x8d> System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object [],System.Globalization.CultureInfo) in <0x1a> System.Reflection.MethodBase:Invoke (object,object[]) in <0x2d> NUnit.Core.Reflect:InvokeMethod (System.Reflection.MethodInfo,object) in <0x5f> NUnit.Core.TestFixture:DoFixtureSetUp (NUnit.Core.TestResult) in <0xcb> NUnit.Core.TestSuite:DoOneTimeSetUp (NUnit.Core.TestResult) in <0xd1> NUnit.Core.TestSuite:Run (NUnit.Core.EventListener,NUnit.Core.IFilter) in <0x1e7> NUnit.Core.TestSuite:RunAllTests (NUnit.Core.TestSuiteResult,NUnit.Core.EventListener,NUnit.Core.IFilter) in <0xe4> NUnit.Core.TestSuite:Run (NUnit.Core.EventListener,NUnit.Core.IFilter) in <0x155> NUnit.Core.SimpleTestRunner:Run (NUnit.Core.EventListener,NUnit.Core.Test[]) in <0x60> NUnit.Core.SimpleTestRunner:Run (NUnit.Core.EventListener,string []) in <0x2c> NUnit.Core.TestRunnerThread:TestRunnerThreadProc () in <0xfffaf630> (wrapper delegate-invoke) System.MulticastDelegate:invoke_void () in <0xff173af7> (wrapper runtime-invoke) System.Object:runtime_invoke_void (object,intptr,intptr,intptr) Native stacktrace: /usr/lib/libmono.so.0(mono_handle_native_sigsegv+0xe5) [0x40094485] /usr/lib/libmono.so.0 [0x400554dd] [0xffffe440] /usr/lib/libglib-2.0.so.0(g_free+0x22) [0x40224c92] [0x4112f283] [0x417e8f6d] [0x417e8e4a] [0x417e8e00] [0x417e3ec9] [0x417e3571] [0x417e3173] [0x417e30c2] [0x41146121] [0x41145d98] [0x4113e1a1] /usr/lib/libmono.so.0 [0x400728c0] /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0x400d68c3] /usr/lib/libmono.so.0(mono_runtime_invoke_array+0x1b0) [0x400dae20] /usr/lib/libmono.so.0 [0x400e1e17] [0x40eef02a] [0x4112318e] [0x40f44e03] [0x41145d06] [0x4113dea0] [0x4113d764] [0x4113d3f2] [0x4113d9b8] [0x4113d405] [0x4113ceee] [0x4113cd49] [0x4113cc9d] [0x40f4f7f0] [0x40efedf1] /usr/lib/libmono.so.0 [0x400728c0] /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0x400d68c3] /usr/lib/libmono.so.0(mono_runtime_delegate_invoke+0x46) [0x400d7bc6] /usr/lib/libmono.so.0 [0x4010a2d6] /usr/lib/libmono.so.0 [0x40157794] /usr/lib/libmono.so.0(GC_start_routine+0x63) [0x40172f03] /lib/tls/libpthread.so.0 [0x40299cfd] /lib/tls/libc.so.6(__clone+0x5e) [0x403a413e] Aborted ---- Additional Comments From dmitryskey@hotmail.com 2006-08-09 05:56:52 MST ---- Created an attachment (id=170232) MaxDB ADO.NET Provider and test cases. Also MaxDB client software has to be installed. ---- Additional Comments From dmitryskey@hotmail.com 2006-08-09 05:59:44 MST ---- Attached file is Tar/GZip archive ---- Additional Comments From vargaz@gmail.com 2006-08-09 08:06:59 MST ---- Tihs is a bug in MaxDB, in particular the following definition in the UnsafeNativeMethods class: [DllImport (...)] public static extern string SQLDBC_ErrorHndl_getSQLState (IntPtr herror); The mono runtime will try to free the string returned by the native getSQLState function after converting it to a C# string, according to the .NET pinvoke memory management rules. The C function probably returns a pointer to non-malloc-ed storage, causing this function to crash. The proper fix is to return an IntPtr, and convert it to a string manually. Please report this as a bug to the MaxDB developers, referencing this note. ---- Additional Comments From vargaz@gmail.com 2006-08-09 08:09:51 MST ---- I mean it is a bug in the MaxDB ADO.NET provider, and not in MaxDB. For more info on string marshalling, see: http://www.mono-project.com/Interop_with_Native_Libraries#Strings_as_Return_Values Imported an attachment (id=170232)