[Mono-bugs] [Bug 676368] New: Should not use ODBC statement handles after SQLDisconnect called

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 2 13:00:56 EST 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=676368#c0


           Summary: Should not use ODBC statement handles after
                    SQLDisconnect called
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: 0richardkk.novell at chiark.greenend.org.uk
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=417126)
 --> (http://bugzilla.novell.com/attachment.cgi?id=417126)
patch that addresses this bug

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.13
(KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13

SQLDisconnect() frees any statements allocated on that
connection, so statement handles become invalid (even to free)
after SQLDisconnect() is called.

OdbcConnection keeps a list of OdbcCommands in order to
destroy them before calling SQLDisconnect, but the list is of
weak references (and for good reason), so once their own
destruction commences, they no longer appear in this list.

Due to the vagaries of thread scheduling it can happen that
destruction of the OdbcCommand commences before
SQLDisconnect() is called but SQLFreeStmt() is called after
it.  (Even worse, they could overlap.)

The result is a crash.



The attached patch works for me.

Reproducible: Always

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


More information about the mono-bugs mailing list