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

Memory leak in mysql_close() with MYSQL_OPT_NONBLOCK

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 3.0.0, 2.2.0
    • Component/s: None
    • Labels:
      None

      Description

      When a mysql connection is created and is set to not blocking, mysql_close() doesn't free the memory associate with async causing a severe memory leak.

      Depending from the the speed of your CPU and your available memory, the follow code can eat all available memory in just few seconds:

      #include <mysql.h>
      #include <stdio.h>
      int main() {
        while(1) {
        MYSQL *mysql=mysql_init(NULL);
        mysql_options(mysql, MYSQL_OPT_NONBLOCK, 0);  // this line triggers the bug
        mysql_close(mysql);
        }
        return 0;
      }

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            rcannao René Cannaò
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.