[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


           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

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

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:


  at (wrapper managed-to-native) System.Data.Odbc.libodbc.SQLFreeStmt
stem.Data.Odbc.libodbc/SQLFreeStmtOptions) <0x00004>
  at (wrapper managed-to-native) System.Data.Odbc.libodbc.SQLFreeStmt
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)
e () <0xffffffff>
  at Program.Main () <0x0031a>
  at (wrapper runtime-invoke) Program.runtime_invoke_int
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