[ODBC-64] Out of Memory using Connector with ADO Created: 2016-11-02  Updated: 2017-02-26  Resolved: 2017-02-26

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: None
Affects Version/s: 2.0.12, 2.0.13
Fix Version/s: 2.0.14, 3.0.1

Type: Bug Priority: Blocker
Reporter: Markus Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: ADO, BLOB, LONGBLOB, OLEDB
Environment:

Windows 32-bit


Attachments: Zip Archive BlobTest.zip     Text File MAODBC.LOG     File maodbc.dll    

 Description   

I've tried to migrate an C++/ADO (not ADO.NET) project from MySQL to MariaDB. While it was easy to replace the MySQL server, I've found a problem with the MariaDB ODBC connector.

Access to the MariaDB is done by the OLEDB to ODBC bridge (MSDASQL). The ADO connection string is something like "Provider=MSDASQL;DSN=TestMariaOdbc". While querying tables with simple fields works as expected, I wasn't able to read values from LONGBLOB columns. The table in question has two columns: id (int), data (longblob). Selecting a row by the id with a data-value of about 2000 bytes leads to the following error:

Error number: 8007000e  Out of Memory
Code = 8007000e
Code meaning = Unknown error 0x8007000E
Source = Microsoft Cursor Engine
Description = Out of Memory.

While performing the query, the memory consumed by the process rapidly grows to more then 1 GB. The same worked with the latest MySQL ODBC driver (5.3.6). I guess that MariaDB ODBC Connector reports at some point the column size (4GB) instead of the actual data size (2KB) and the ODBC bridge tries to allocate an appropriate buffer...



 Comments   
Comment by Lawrin Novitsky [ 2016-11-02 ]

Thank you for your report!
Would it be possible to provide ODBC trace for your test case?
That would help us to fix the bug faster.
p.s. and table structure could also be useful.

Comment by Markus [ 2016-11-03 ]

I've attached a small demo project (Visual Studio 10). The project contains an SQL script to create the table and insert a record. You could use a DSN or DSN-less connection to the database. With this project, It should be easy to create an ODBC trace.

Unfortunately there is no documentation about tracing:

  • How to enable in DSN-less connections
  • Where to find the log (I finally located it in user-temp dir with name MAODBC.log)
Comment by Lawrin Novitsky [ 2017-02-26 ]

Sorry, I have finally got back to your bug report. Running your testcase against latest repository version of MariaDB C/ODBC, I get "Unsupported Variant Type: 8209" exception in the getAsString, while I can see "Hello world" inside variant value. And I in the ODBC trace(of running your testcase) there is nothing suspicious - it shows, that the application could safely SQLGetData 11 bytes of "Hello world" from the connector.
So, I guess the problem has been fixed already, and am closing the bug.
I will attach here dll file of the driver I tested against. You can verify if your problem is really fixed, and re-open the bug if it is not. Or maybe report new issue

Comment by Lawrin Novitsky [ 2017-02-26 ]

As for connector's debug log. In dsn-less connection it is turned on by setting bit 4 of OPTION/OPTIONS connection string option. It is stored in ENV

{TMP}

or ENV

{USERPROFILE}

(on WIndows). But it's not intended for wide use. What I asked you, and that is sufficient in 99% of cases, is ODBC trace, that can be turned on in ODBC Data Source Administrator on the tab Tracing.
Still, sorry that connector's debug option is not documented

Generated at Thu Feb 08 03:25:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.