Bug #27368 MyODBC v5 crash
Submitted: 22 Mar 2007 7:00 Modified: 13 Jun 2007 17:09
Reporter: Andrew Sitnikov Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.0.12-20070320 OS:Windows (winxp)
Assigned to: Jess Balint CPU Architecture:Any

[22 Mar 2007 7:00] Andrew Sitnikov
Description:
 	MYODBCDriver5.dll!QObject::parent()  Line 218 + 0x11 bytes	C++
 	MYODBCDriver5.dll!MCommands::getStatement()  Line 464	C++
>	MYODBCDriver5.dll!MCommands::getConnection()  Line 428 + 0x6b bytes	C++
 	MYODBCDriver5.dll!MCommand::getConnection()  Line 647	C++
 	MYODBCDriver5.dll!MCommand::doCreateResult()  Line 705 + 0x8 bytes	C++
 	MYODBCDriver5.dll!MCommand::setText(const QString & stringText={...}, unsigned int nParameterOffset=0)  Line 617	C++
 	MYODBCDriver5.dll!MCommands::setText(const QString & stringText={...})  Line 80 + 0x13 bytes	C++
 	MYODBCDriver5.dll!MStatement::doPrepare(wchar_t * psStatementText=0x08537360, long nLength1=-3)  Line 2926 + 0xc bytes	C++
 	MYODBCDriver5.dll!MStatement::doExecDirect(wchar_t * psStatementText=0x08537360, long nTextLength=-3)  Line 1941 + 0x10 bytes	C++
 	MYODBCDriver5.dll!SQLExecDirectW(void * hStm=0x08d31df8, wchar_t * psStatementText=0x08537360, long nTextLength=-3)  Line 69	C++
 	odbc32.dll!74325432() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for odbc32.dll]	
 	odbc32.dll!7434531a() 	
 	MSRDO20.DLL!2367923a() 	
 	MSRDO20.DLL!2367910d() 	
 	kernel32.dll!7c80b683() 	

How to repeat:
SQL:

SELECT c.CustomerID as CustomerID, aa.ActivityNo as ActivityNo, aa.eDate as eDate FROM tblAccountActivity aa, tblCustomer c, tblUser u, tblBillingPlanComponent bp WHERE aa.UserID = u.UserID AND u.CustomerID = c.CustomerID AND aa.ComponentID=bp.ComponentID  AND ActivityNo IN (-1,302025,302021) AND c.NoBill='-1' AND c.Dealer IN (1,4) AND aa.Invoiced='0' AND InvoiceNo IS NULL AND bp.PlanID<>'ZZPMT' AND aa.Tax='0' ORDER BY c.CustomerID
[22 Mar 2007 8:59] Tonci Grgin
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Explanation:
Hi Andrew and thanks for your report.
Can you please:
 - Post MySQL server version
 - Attach DDL script
 - Attach C or C++ standalone test case demonstrating the problem each time on given DDL script
 - Run same query in mysql cl client and see what happens
 - Attach general query log from server at the time of error, providing prior test in cl client works. If prior test fails then it's a server problem
 - Attach ODBC log at the time of error
[22 Mar 2007 9:17] Andrew Sitnikov
DDL

Attachment: ib.ddl (application/octet-stream, text), 6.17 KiB.

[22 Mar 2007 9:33] Andrew Sitnikov
>Post MySQL server version
mysql> show variables like 'version';
+---------------+------------+
| Variable_name | Value      |
+---------------+------------+
| version       | 5.0.37-log | 
+---------------+------------+
1 row in set (0.00 sec)

> Attach C or C++ standalone test case demonstrating the problem eachtime on given DDL script
this query run from ms access (direct cennection), very difficult for me make  standalone test case.

> - Attach DDL script
done

> - Run same query in mysql cl client and see what happens
mysql> use ib_dev;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT c.CustomerID as CustomerID, aa.ActivityNo as ActivityNo, aa.eDate as eDate FROM tblAccountActivity aa, tblCustomer c, tblUser u, tblBillingPlanComponent bp WHERE aa.UserID = u.UserID AND u.CustomerID = c.CustomerID AND aa.ComponentID=bp.ComponentID  AND ActivityNo IN (-1,302025,302021) AND c.NoBill='-1' AND c.Dealer IN (1,4) AND aa.Invoiced='0' AND InvoiceNo IS NULL AND bp.PlanID<>'ZZPMT' AND aa.Tax='0' ORDER BY c.CustomerID;
+------------+------------+------------+
| CustomerID | ActivityNo | eDate      |
+------------+------------+------------+
|       4811 |     302021 | 2007-03-21 | 
|       4811 |     302025 | 2007-03-21 | 
+------------+------------+------------+
2 rows in set (0.05 sec)

with v3.51  odbc this query work properly 

> - Attach ODBC log at the time of error
done
[22 Mar 2007 11:29] Tonci Grgin
Thanks Andrew.
Correct me if I'm wrong:
 - You have given query running on tables (attached) from MS Access
 - You have MySQL server 5.0.37 and connector/ODBC v5

 - I see youy have general query log enabled on server. Attaching relevant portion of it might help me to find out what's happening.
 - ODBC trace is cut too soon (before error is risen).
 - Are you sure I can repeat this behavior without data (DDL script contains none)?
[22 Mar 2007 12:09] Andrew Sitnikov
> - You have given query running on tables (attached) from MS Access
yes

> - You have MySQL server 5.0.37 and connector/ODBC v5
yes

> - I see you have general query log enabled on server. Attaching relevant
portion of it might help me to find out what's happening.
> - ODBC trace is cut too soon (before error is risen).
i will upload full odcb & server log (from access start)

last lines in server side
070322 13:52:31     172 Connect     admin@si-2.infonet.ee on ib_dev
                    172 Query       SET SQL_AUTO_IS_NULL=0
                    172 Query       SET NAMES utf8

is your can see no query execution. pls check first my post for backtrace 
> - Are you sure I can repeat this behavior without data (DDL script contains
none)?
not sure, but I do not have rights to distribute this information. as the query does not run a server side I do not think that data have in this case value.
[22 Mar 2007 12:58] Tonci Grgin
Hi Andrew. I am unable to repeat the problem described.
This could be due to lack of data in the tables or due to differences in environment.

Environment:
  - MySQL server 5.0.38BK on WinXP Pro SP2 localhost (this should not be a problem as you are able to run this query in cl client)
  - connector/ODBC 5.0, mysql-connector-odbc-5.0-win32-nightly-20070322.zip
  - MS Access 2003 Pro SP2 (11.6566.8122)

Test:
  - Import attached script
  - Open new Access database, link all tables
  - Create new query (found earlier in report and in logs)
  - Run query

There are a lot of <SQL_QUERY_TIMEOUT> in your log so it might be usefull for you to try this on a smaller subset of data and see if it works. In case it works, finetuning of server parameters might help.
[22 Mar 2007 14:36] Andrew Sitnikov
run Form1 & Click "Crash me" button
[22 Mar 2007 18:03] Andrew Sitnikov
verified with 
Windows XP SP2 + Microsoft Office Access 2003 (11.5614.5606) (fresh install)
Windows XP SP2 + Microsoft Office Access 2002 (10.6771.6811)
[23 Mar 2007 13:49] Tonci Grgin
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.

Explanation:
Andrew, what do you want me to do exactly? Review your code, debug Access? The query in itself works. Why is Access crashing is beyound me so I posted bug report to M$. As we in MySQL do care about community, I will consult more on this problem.

Comment:
At first I thought Access doesn't like STMT=SET SQL_AUTO_IS_NULL=0; as per http://dev.mysql.com/doc/refman/5.0/en/set-option.html but it crashed anyway.
As can be seen in the log:
070323 14:29:32	      8 Connect     root@localhost on test
		      8 Query       SET SQL_AUTO_IS_NULL=0
		      8 Query       SET NAMES utf8
070323 14:33:37	      9 Connect     root@localhost on test
		      9 Query       SET NAMES utf8
Access crashes before sending query to MySQL server...
[23 Mar 2007 13:50] Tonci Grgin
MyODBC5 trace, using STMT=3;

Attachment: MYODBC5.7z (application/octet-stream, text), 20.55 KiB.

[23 Mar 2007 15:49] Andrew Sitnikov
ms access crash INSIDE myodbc (pls check backtrace)
ms access not crash with  myodbc v3.51

I have checked up crashme.mdb on 4 different computers with different versions ms access, everywhere with myodcb v5.0 we have crash ...

>Access crashes before sending query to MySQL server...
I have told about this at [22 Mar 13:09] 

>At first I thought Access doesn't like STMT=SET SQL_AUTO_IS_NULL=0; as per
It is not important in this case, without  STMT it crash in MYODBC anyway 

Because crash occurs in myodbc I am inclined to think that it all the same a problem in myodbc v5.0. This code  perfectly works many years with myodcb v2.50-3.51 with many ms access/mysql  versions
[23 Mar 2007 16:14] Tonci Grgin
Andrew, I said I'll consult...

> Because crash occurs in myodbc I am inclined to think that it all the same a
problem in myodbc v5.0.

Colud be. Can you please try 5.00.11-beta from http://dev.mysql.com/downloads/connector/odbc/5.0.html and see if it crashes Access? If it doesn't crash Access then I have a pretty good idea what's gone wrong.

> This code  perfectly works many years with myodcb v2.50-3.51 with many ms access/mysql  versions

2.5 was not ODBC compliant so we had to abandon it.
[23 Mar 2007 16:41] Andrew Sitnikov
Run time error 3146
ODBC call failed
[23 Mar 2007 21:33] Andrew Sitnikov
Driver: MySQL ODBC 3.51 Driver
CONNECT STR: ODBC;SERVER=host;DRIVER=MySQL ODBC 3.51 Driver;PWD=foo;DATABASE=test;UID=bar
SQL: SELECT now() FROM dual
Result: OK

Driver: MySQL ODBC 5.0.11 Driver
CONNECT STR: ODBC;SERVER=host;DRIVER=MySQL Connector/ODBC v5;PWD=foo;DATABASE=test;UID=bar
SQL: SELECT now()  FROM dual
Result: Error  S1091: [MySQL][MyODBC 5.0.11]Descriptor type out of range

Driver: MySQL ODBC 5.0.12-20070320 Driver
CONNECT STR: ODBC;SERVER=host;DRIVER=MySQL Connector/ODBC v5;PWD=foo;DATABASE=test;UID=bar
SQL: SELECT now()  FROM dual
Result: ms access crash

P.S. ODBC logs attached
[23 Mar 2007 21:34] Andrew Sitnikov
myodbc_v511

Attachment: myodbc_v511.LOG (application/octet-stream, text), 40.54 KiB.

[23 Mar 2007 21:50] Andrew Sitnikov
SQL LOg from server

MyODBC v3.51

070323 23:47:38   20360 Connect     mysqldev@si-2.infonet.ee on test
                  20360 Query       SET SQL_AUTO_IS_NULL=0
                  20357 Quit       
                  20360 Query       SELECT now()  FROM dual

MyODBC v5.0.11

070323 23:48:57   20377 Connect     mysqldev@si-2.infonet.ee on test
                  20377 Query       SET NAMES utf8
                  20360 Quit       
                  20377 Query       SELECT now()  FROM dual
                  20377 Query       SELECT * FROM SELECT now()  FROM dual
[24 Mar 2007 16:39] Tonci Grgin
Andrew, thanks. There is indeed a bug surfaced during Qt lib upgrade. We are giving this maximum priority.
[10 Apr 2007 19:12] Jess Balint
Please test against new snapshot. Should be fixed.