Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-31

After error 1153, calling mysql_real_query() hangs

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Windows

    Description

      When inserting data into a blob field, if the size of the data is greater than max_allowed_packet, we get an error saying that the size is > max_allowed_packet (1153). A subsequent call to mysql_real_query() causes it to hang. A subsequent call to mysql_close() crashes.

      Attachments

        1. blob6.sql
          1.63 MB
          Janani SriGuha
        2. callstack.bmp
          926 kB
          Janani SriGuha
        3. max_allowed_packet.cpp
          2 kB
          Janani SriGuha

        Activity

          georg Georg Richter added a comment -

          Could you please provide some more information:

          1) Which bzr revision number do you use (bzr log -l1 gobes you latest revision)
          2) A short repeatable test case

          Thanks!

          georg Georg Richter added a comment - Could you please provide some more information: 1) Which bzr revision number do you use (bzr log -l1 gobes you latest revision) 2) A short repeatable test case Thanks!

          Hi,

          We are using revision 64.

          This is reproducible using the community version of SQLyog, but will give a shorter test case in a day.

          janani_87 Janani SriGuha added a comment - Hi, We are using revision 64. This is reproducible using the community version of SQLyog, but will give a shorter test case in a day.
          janani_87 Janani SriGuha added a comment - - edited

          Hi,

          I'm sorry, the bug report is incorrect.

          The issue is that when we get the error 1135, the server status is being set to 0xfffffff7 - and in mysql_real_escape_string() it takes it as the SERVER_STATUS_NO_BACKSLASH_ESCAPES being set and incorrectly escapes, or rather does not escape, the (binary) data, truncating it. Since the truncated data size < max allowed packet, it was inserting the data. When the data is text, since the server state is incorrectly set, in the next command it hangs in mysql_real_query -> mthd_my_send_cmd -> net_clear.
          The call stack is attached.

          Also, while using the mysql connector, we always get the error 1153 for this case. However, in the mariadb connector it alternates between errors 1153 and 2013.

          janani_87 Janani SriGuha added a comment - - edited Hi, I'm sorry, the bug report is incorrect. The issue is that when we get the error 1135, the server status is being set to 0xfffffff7 - and in mysql_real_escape_string() it takes it as the SERVER_STATUS_NO_BACKSLASH_ESCAPES being set and incorrectly escapes, or rather does not escape, the (binary) data, truncating it. Since the truncated data size < max allowed packet, it was inserting the data. When the data is text, since the server state is incorrectly set, in the next command it hangs in mysql_real_query -> mthd_my_send_cmd -> net_clear. The call stack is attached. Also, while using the mysql connector, we always get the error 1153 for this case. However, in the mariadb connector it alternates between errors 1153 and 2013.

          Have attached a test case for this case. Ran this on Visual Studio 10.0. The max_allowed_packet on the server where this is tested should be set to 1MB.

          janani_87 Janani SriGuha added a comment - Have attached a test case for this case. Ran this on Visual Studio 10.0. The max_allowed_packet on the server where this is tested should be set to 1MB.
          georg Georg Richter added a comment -

          Fixed in rev. 68

          georg Georg Richter added a comment - Fixed in rev. 68

          People

            georg Georg Richter
            janani_87 Janani SriGuha
            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.