Bug #27458 MyODBC 3.5.14 crashes using cached command objects
Submitted: 26 Mar 2007 22:58 Modified: 6 Sep 2007 22:21
Reporter: Michael Pryor (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:3.51.14 OS:Windows (Windows)
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: myodbc command

[26 Mar 2007 22:58] Michael Pryor
Description:
A class has a command object as it's member variable.  If a recordset is created from that class it will work the first time, and then crash the second time.

How to repeat:
I've created the most slimmed down base case I could:

First create the mysql database:

mysql> create database A;
mysql> use A;
mysql> create table B (c int);
mysql> insert into B values(1);
mysql> insert into B values(2);
mysql> insert into B values(3);

Now create a virtual directory in IIS and a new text file called test.asp and put the following code in it and run it via a browser.  Notice it will say test succeded. Now uncomment the second f.Write line at the bottom of the file and run it again.  Notice it now crashes. (and the pooled connection to mysql is now mangled also because the next time you refresh the page, it now crashes on the db.Open call).

-----------
<%

Dim db: Set db = Server.CreateObject("ADODB.Connection")
db.Open "DRIVER={MySQL ODBC 3.51 Driver};PORT=3306;SERVER=localhost;USER=root;PASSWORD=abcdef;OPTION=278531;DATABASE=A"

Class Foo

	Public cmd

	Sub Class_Initialize

		Set cmd = Server.CreateObject("ADODB.Command")
		cmd.ActiveConnection = db
		cmd.CommandText = "SELECT * from B"

	End Sub

	Sub Write

		Dim rs: Set rs = cmd.Execute()
		While Not rs.EOF

			Response.Write rs("c")
			rs.MoveNext

		Wend
		rs.Close

	End Sub

End Class

Dim f: Set f = New Foo
f.Write

'f.Write

%>

Test succeeded

-----------
[26 Mar 2007 22:59] Michael Pryor
Please note, this code runs successfully under previous versions of MyODBC (such as 3.5.12)
[15 Apr 2007 13:45] Tonci Grgin
Hi Michael and thanks for your report. I'm trying to clarify things in ODBC specs. When conclusion is reached, I'll inform you.
[28 Apr 2007 20:37] Tonci Grgin
Michael, thanks for your excellent report. We all agreed that it *should work* thus verified as described with test case attached.

Environment:
 - MySQL server 5.0.387BK on WinXPPro SP2 localhost
 - MyODBC 3.51.14GA

Connector/ODBC v5 produces correct result.
[28 Apr 2007 20:39] Tonci Grgin
Test case and rellevant logs

Attachment: 27458test-logs.zip (application/x-zip-compressed, text), 6.72 KiB.

[30 Apr 2007 15:21] Bogdan Degtyariov
I was able to repeat the problem. However, the reason of the problem is not obvious. There is no failures on MyODBC side. And no errors. Trying to clarify the situation more using VS debugger
[13 Jun 2007 15:36] Tonci Grgin
Bug#28891 was marked as duplicate of this one (tested with 3.51.16r491).
[6 Sep 2007 9:46] Tonci Grgin
Bug#30818 was marked duplicate of this one (and, in turn, Bug#28891).
[6 Sep 2007 22:21] Bogdan Degtyariov
The bug is fixed in MyODBC 3.51.19.
Thanks for the bug report.