Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-49789

PostgreSQL: memory leak in QPSQLDriverPrivate::getPSQLVersion()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.6.0 RC
    • 5.5.1
    • None
    • Debian 7 amd64, Ubuntu 14.04 amd64
      Qt 5.5.1 from online installer
      PostgreSQL 9.4.5 from apt.postgresql.org
    • e8eaf82e584c2d27bdeb0a50055e10d55d9c00dc

    Description

      After migrating from 5.2.1 to 5.5.1 we noticed >1GB leak per 12h at server software making about 10-20 connections to PostgreSQL database per second. After some investigation I've found leak here:

      http://code.qt.io/cgit/qt/qtbase.git/tree/src/sql/drivers/psql/qsql_psql.cpp?h=5.5#n760

      result variable is overwritten without releasing it's previous resource.

      There is another question - why this block is entered in the first place if I'm using PostgreSQL and libpq5 from pgdg repository with version 9.4.5:

      apt-cache policy libpq5
      libpq5:
        Installed: 9.4.5-1.pgdg14.04+1
        Candidate: 9.4.5-1.pgdg14.04+1
        Version table:
       *** 9.4.5-1.pgdg14.04+1 0
              500 http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg/main amd64 Packages
              100 /var/lib/dpkg/status
           9.3.10-0ubuntu0.14.04 0
              500 http://lt.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
              500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
           9.3.4-1 0
              500 http://lt.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
      

      Maybe it's something to do with ifdefs above on Qt build server environment? If I build libsqlpsql.so in Debian 7 machine using packages from apt.postgresql.org, there is no leak.

      Attachments

        For Gerrit Dashboard: QTBUG-49789
        # Subject Branch Project Status CR V

        Activity

          People

            talkless Vincas Dargis
            talkless Vincas Dargis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes