libpq3 + ssl memory leak

Поиск
Список
Период
Сортировка
От Olaf Hartmann
Тема libpq3 + ssl memory leak
Дата
Msg-id 3FCE1425.3030400@telemedsys.de
обсуждение исходный текст
Ответы Re: libpq3 + ssl memory leak  (Neil Conway <neilc@samurai.com>)
Список pgsql-bugs
============================================================================
                         POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Olaf Hartmann
Your email address      : hao@telemedsys.de


System Configuration
---------------------
   Architecture (example: Intel Pentium)         : i386

   Operating System (example: Linux 2.0.26 ELF)  : linux-2.4.21

   PostgreSQL version (example: PostgreSQL-7.3.4): PostgreSQL-7.4

   Compiler used (example:  gcc 2.95.2)          : gcc 3.3.2


Please enter a FULL description of your problem:
------------------------------------------------

We expirience a memory leak with every connection when using an SSL
encrypted TCP connection to connect a postgres database.
A simple code example is included in this mail. It simply opens and
closes a database connection. (You also need a postgresql server set up
for ssl.)

'valgrind' detects the main memory leak (which gets bigger with every
connection) to be in libcrypto.so.0.9.7. But you can also verify the
increased memory consumption using 'ps axl', if you add a 'sleep(..);'
at the end of the program.


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------


/*
  * begin leak.c
  */

#include <stdio.h>
#include <postgresql/libpq-fe.h>

int main()
{
   int i;
   PGconn *conn;

   for (i = 0; i < 10; i ++)
   {
     conn = PQconnectdb("host=... dbname=template1 ... requiressl=1");
     if (PQstatus(conn) == CONNECTION_BAD)
     {
       fprintf(stderr, "Error: %s", PQerrorMessage(conn));
       PQfinish(conn);
       exit(1);
     }
     PQfinish(conn);
   }
   return 0;
}

/*
  * end leak.c
  */


$ gcc leak.c -lpq -o leak


$ valgrind --leak-check=yes --error-limit=no ./leak


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Joseph Tate
Дата:
Сообщение: Seg Fault when using modules linked both to libpq and libodbcpsql.
Следующее
От: lanewhoy@mrcoffee.umich.edu
Дата:
Сообщение: Failed regression test in postgresql-7.4