Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-447

When trying to use ODBC command FillSchema I get a crash every time / module faulting

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 3.2.4
    • 3.2.5
    • General
    • Windows 11
      Visual Studio 2022

    Description

      MariaDB ODBC Connector crashes when trying to use FillSchema. I get a faulting module error (see below)

      I have tried this against MyISAM and InnodDB tables and it make no difference.

      Note: We are trying to move off MySQL ODBC, where this has always worked.

      ExampleCode

      var queryStr = new StringBuilder();
      queryStr.Append("SELECT * FROM ")
      .Append("`" + tableName + "`")
      .Append(" LIMIT 0 ");

      bool querySuccessful;
      var dsTable = new DataTable();
      using (var dbConn = new OdbcConnection(connectionStr))
      {
      using (var cmd = new OdbcDataAdapter(queryStr.ToString(), dbConn))

      { dbConn.Open(); cmd.FillSchema(dsTable, SchemaType.Mapped); querySuccessful = true; }

      }

      EventViewer

      Faulting application name: iisexpress.exe, version: 10.0.26013.1000, time stamp: 0x79017a52
      Faulting module name: maodbc.dll, version: 3.2.4.0, time stamp: 0x6731f3cb
      Exception code: 0xc0000005
      Fault offset: 0x00000000001510d0
      Faulting process id: 0x0x9158
      Faulting application start time: 0x0x1DB45AD6FAF192D
      Faulting application path: C:\Program Files\IIS Express\iisexpress.exe
      Faulting module path: C:\Program Files\MariaDB\MariaDB ODBC Driver 64-bit\maodbc.dll
      Report Id: cda089b4-12de-45fe-9eb7-c387d2aea5bf
      Faulting package full name:
      Faulting package-relative application ID:

      Attachments

        Activity

          Thank you for your report. Since it looks to be under IIS it won't be possible to get the ODBC trace for the issue. Would it be possible to provide a standalone test to repeat the issue?

          Lawrin Lawrin Novitsky added a comment - Thank you for your report. Since it looks to be under IIS it won't be possible to get the ODBC trace for the issue. Would it be possible to provide a standalone test to repeat the issue?
          Paul H Paul H added a comment -

          Hi there, thank you for your reply.

          I put the same code into a Console Application.
          [Again: works for MySQL ODBC and fails for MariaDB ODBC.]

          This time using MariaDB ODBC I get an error message: "System.AccessViolationException: 'Attempted to read of write protected memory. This is often an indication that other memory is corrupt.'"

          Stack Trace:

          at System.Data.Common.UnsafeNativeMethods.SQLMoreResults(OdbcStatementHandle StatementHandle)
          at System.Data.Odbc.OdbcStatementHandle.MoreResults()
          at System.Data.Odbc.OdbcDataReader.NextResult(Boolean disposing, Boolean allresults)
          at System.Data.Odbc.OdbcDataReader.Close(Boolean disposing)
          at System.Data.Odbc.OdbcDataReader.Dispose(Boolean disposing)
          at System.Data.Common.DbDataReader.Dispose()
          at System.Data.Common.DbDataAdapter.FillSchemaInternal(DataSet dataset, DataTable datatable, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior)
          at System.Data.Common.DbDataAdapter.FillSchema(DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior)
          at System.Data.Common.DbDataAdapter.FillSchema(DataTable dataTable, SchemaType schemaType)
          at ConsoleApp3.Program.Main(String[] args) in C:\Users\paulh\source\repos\ConsoleApp3\ConsoleApp3\Program.cs:line 40

          Console application code:-

          using System.Data.Odbc;
          using System.Data;

          var tableName = "table_for_mariadb_testing";

          var queryStr = new StringBuilder();
          queryStr.Append("SELECT * FROM ")
          .Append("`" + tableName + "`")
          .Append(" LIMIT 1 ");

          bool querySuccessful;
          var dsTable = new DataTable();

          try
          {
          using (var dbConn = new OdbcConnection(connectionStr))
          {
          using (var cmd = new OdbcDataAdapter(queryStr.ToString(), dbConn))

          { dbConn.Open(); cmd.FillSchema(dsTable, SchemaType.Mapped); querySuccessful = true; }

          }
          }
          catch (Exception gExc)

          { querySuccessful = false; }

          }

          Paul H Paul H added a comment - Hi there, thank you for your reply. I put the same code into a Console Application. [Again: works for MySQL ODBC and fails for MariaDB ODBC.] This time using MariaDB ODBC I get an error message: "System.AccessViolationException: 'Attempted to read of write protected memory. This is often an indication that other memory is corrupt.'" Stack Trace: at System.Data.Common.UnsafeNativeMethods.SQLMoreResults(OdbcStatementHandle StatementHandle) at System.Data.Odbc.OdbcStatementHandle.MoreResults() at System.Data.Odbc.OdbcDataReader.NextResult(Boolean disposing, Boolean allresults) at System.Data.Odbc.OdbcDataReader.Close(Boolean disposing) at System.Data.Odbc.OdbcDataReader.Dispose(Boolean disposing) at System.Data.Common.DbDataReader.Dispose() at System.Data.Common.DbDataAdapter.FillSchemaInternal(DataSet dataset, DataTable datatable, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillSchema(DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillSchema(DataTable dataTable, SchemaType schemaType) at ConsoleApp3.Program.Main(String[] args) in C:\Users\paulh\source\repos\ConsoleApp3\ConsoleApp3\Program.cs:line 40 Console application code:- using System.Data.Odbc; using System.Data; var tableName = "table_for_mariadb_testing"; var queryStr = new StringBuilder(); queryStr.Append("SELECT * FROM ") .Append("`" + tableName + "`") .Append(" LIMIT 1 "); bool querySuccessful; var dsTable = new DataTable(); try { using (var dbConn = new OdbcConnection(connectionStr)) { using (var cmd = new OdbcDataAdapter(queryStr.ToString(), dbConn)) { dbConn.Open(); cmd.FillSchema(dsTable, SchemaType.Mapped); querySuccessful = true; } } } catch (Exception gExc) { querySuccessful = false; } }

          .Net sends SQLMoreResults on the statement after preparing query and w/out executing. I've verified that it does the same for MySQL's driver. But for our driver it came as a bit of surprise. DM doesn't think it's "HY010 Function sequence error" thus we shouldn't as well.

          Lawrin Lawrin Novitsky added a comment - .Net sends SQLMoreResults on the statement after preparing query and w/out executing. I've verified that it does the same for MySQL's driver. But for our driver it came as a bit of surprise. DM doesn't think it's "HY010 Function sequence error" thus we shouldn't as well.

          People

            Lawrin Lawrin Novitsky
            Paul H Paul H
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.