[ODBC-247] Multiple batches via .NET gives AccessViolationException Created: 2019-05-08 Updated: 2023-11-22 Resolved: 2023-11-22 |
|
| Status: | Closed |
| Project: | MariaDB Connector/ODBC |
| Component/s: | General |
| Affects Version/s: | 3.0.9 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Kristian Wedberg | Assignee: | Lawrin Novitsky |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Server: Windows 7 SP1 64-bit, MariaDB 10.3.9 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Executing
via .NET ExecuteNonQueryAsync() throws a System.AccessViolationException instead of e.g. an OdbcException:
Trace attached. |
| Comments |
| Comment by Lawrin Novitsky [ 2019-05-08 ] | ||||||||||||||||||||
|
Thank you for your report. In the trace there is the error in the query execution. That is probably main bug here. Probably your application incorrectly interprets or doesn't process the error and calls SQLMoreResults. It still not the reason for the connector to crash, though. | ||||||||||||||||||||
| Comment by Kristian Wedberg [ 2019-05-08 ] | ||||||||||||||||||||
|
Yes, the trace says SQL syntax is incorrect. The problem is that an AccessViolationException is thrown, which is unexpected, instead of an OdbcException. On the .NET side, all I'm doing is the below, nothing else.
| ||||||||||||||||||||
| Comment by Lawrin Novitsky [ 2019-05-08 ] | ||||||||||||||||||||
|
Strange, I cannot re-create execution failure odbc_unicode -d 563c-4a00 EXIT SQLExecDirectW with return code 0 (SQL_SUCCESS) Are you sure that latest connector version is used? Could you please verify that? | ||||||||||||||||||||
| Comment by Lawrin Novitsky [ 2019-05-08 ] | ||||||||||||||||||||
|
Perhaps that is because you are using Async functions. But I've got it - that happens inside .Net | ||||||||||||||||||||
| Comment by Kristian Wedberg [ 2019-05-08 ] | ||||||||||||||||||||
|
Yes, definitely "MariaDB ODBC 3.0 Driver", version 3.0.9 (and 3.0.8 was the same.) | ||||||||||||||||||||
| Comment by Kristian Wedberg [ 2019-05-08 ] | ||||||||||||||||||||
|
Same happens without async, calling Open() and ExecuteNonQuery():
| ||||||||||||||||||||
| Comment by Lawrin Novitsky [ 2019-05-08 ] | ||||||||||||||||||||
|
Silly me - the version can be seen in the trace in the driver signature in the error text. That is strange, that after execution error .Net calls SQLMoreResults. Async was my guess of the reason. You proved it was wrong. Now, I don't really have ideas why the query execution fails for you, but not for me. From the odbc point of view my testcase identical to yours. Would it still fail if all statement are put in single row without any new row characters? | ||||||||||||||||||||
| Comment by Kristian Wedberg [ 2019-05-08 ] | ||||||||||||||||||||
|
Yes, same failure with:
| ||||||||||||||||||||
| Comment by Lawrin Novitsky [ 2019-05-10 ] | ||||||||||||||||||||
|
Forgot to mention, that I cannot reproduce crash in the SQLMoreResults either. | ||||||||||||||||||||
| Comment by Tomas Vladik [ 2023-10-17 ] | ||||||||||||||||||||
|
I was able to reproduce the same exception in my environment. I got fresh system Windows Server: Then install:
Started DB in docker like this:
Actual result:
| ||||||||||||||||||||
| Comment by Lawrin Novitsky [ 2023-10-17 ] | ||||||||||||||||||||
|
tomas.vladik Thank you for additional information and the testcase. I haven't run it yet, but looked in the code, and in connection string OPTION is 3, while for enable multiple statements it has to also contain the bit 67108864. Without that option set multiple statement should not work. Could you please add it and see if it still does not work? or I'll do this later. | ||||||||||||||||||||
| Comment by Tomas Vladik [ 2023-10-18 ] | ||||||||||||||||||||
|
Ok, with ;Option=67108864 it passes green. But still it seems to me not correct to get AccessViolationException, when there is wrong combination of connection string and SQL query. | ||||||||||||||||||||
| Comment by Tomas Vladik [ 2023-11-01 ] | ||||||||||||||||||||
|
Does have any drawback to use flag Option=67108864 in connection string every time? | ||||||||||||||||||||
| Comment by Lawrin Novitsky [ 2023-11-22 ] | ||||||||||||||||||||
|
tomas.vladik The driver returns SQL syntax error and points to the beginning of 2nd query as the place where the error is found. The error you see is rendered by .Net and I don't think we can have control over it. I'm gonna close the ticket, as I think the reason for initial report is the same connection string option. My bad, that I never asked. Should be the first thing I had thought of. But somehow the first thing that crosses my mind, is always "bug in the connector" =) | ||||||||||||||||||||
| Comment by Lawrin Novitsky [ 2023-11-22 ] | ||||||||||||||||||||
|
Apparently the reason behind the initial report is not selected connection string option enabling multistatement queries. That had to be the first question I had asked, but somehow I did not |