[Mono-bugs] [Bug 341743] New: Odbc: SIGSEGV in OdbcCommand.FreeStatement

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 14 16:00:38 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=341743

           Summary: Odbc: SIGSEGV in OdbcCommand.FreeStatement
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: vvaradhan at novell.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at ximian.com
          Found By: ---


When an OdbcConnection is finalized before a given OdbcCommand that is
associated with that OdbcConnection, then a SIGSEGV is reported because the
handle of the SQL statement should've been released before the connection
handle is released.

There are (at least) two cases where the SQL statement handle is not
immediately closed:

1) When the OdbcCommand is prepared.
2) When the SQL statement cannot be successfully executed in
OdbcCommand.ExecuteNonQuery.

The second case actually seems like a bug to me. We should probably free the
statement handle in a finally there (when freeHandle is true and prepared is
false).

The first case is not something that can be fixed in OdbcCommand itself. The
only way to ensure that the statement handles are released before the
connection handle is released, is by disposing all OdbcCommand instances
associated with the OdbcConnection.

To reproduce:

1. modify the values in the CreateOdbcConnectionString method of the attached
source code to match your local setup.
2. compile and run it.

Actual result:

Stacktrace:

  at (wrapper managed-to-native) System.Data.Odbc.libodbc.SQLFreeStmt
(intptr,Sy
stem.Data.Odbc.libodbc/SQLFreeStmtOptions) <0x00004>
  at (wrapper managed-to-native) System.Data.Odbc.libodbc.SQLFreeStmt
(intptr,Sy
stem.Data.Odbc.libodbc/SQLFreeStmtOptions) <0xffffffff>
  at System.Data.Odbc.OdbcCommand.FreeStatement () <0x0001f>
  at System.Data.Odbc.OdbcCommand.Dispose (bool) <0x00014>
  at System.ComponentModel.Component.Dispose () <0x0000d>
  at (wrapper remoting-invoke-with-check)
System.ComponentModel.Component.Dispos
e () <0xffffffff>
  at Program.Main () <0x0031a>
  at (wrapper runtime-invoke) Program.runtime_invoke_int
(object,intptr,intptr,i
ntptr) <0xffffffff>

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Expected result:

Successful execution (exit code 0)


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list