leak in libpq, getpwuid

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: leak in libpq, getpwuid
Date: 2009-02-17 13:33:37
Message-ID: 2f4958ff0902170533w5d520d1bv91a7239c9079aacb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey folks,

I am getting leaks on my machine, valgrind points to getpwuid_r called
by libpq's PQConnectDb()

==11784== 32,772 bytes in 1 blocks are indirectly lost in loss record 31 of 31
==11784== at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==11784== by 0x63D9FCB: ???
==11784== by 0x63C10FD: ???
==11784== by 0x63AF5BE: ???
==11784== by 0x63AFB4D: ???
==11784== by 0x63A0C0E: ???
==11784== by 0x63A3520: ???
==11784== by 0x63A42BD: ???
==11784== by 0x63A4A86: ???
==11784== by 0x63A513F: ???
==11784== by 0x4949C1: getpwuid_r@@GLIBC_2.1.2 (in /lib/libc-2.8.so)
==11784== by 0x297F2D: (within /usr/lib/libpq.so.5.1)
==11784== by 0x283050: (within /usr/lib/libpq.so.5.1)
==11784== by 0x287118: (within /usr/lib/libpq.so.5.1)
==11784== by 0x287269: (within /usr/lib/libpq.so.5.1)
==11784== by 0x2875AE: PQconnectStart (in /usr/lib/libpq.so.5.1)
==11784== by 0x287601: PQconnectdb (in /usr/lib/libpq.so.5.1)

The application fires up few threads once in a while, and they connect
to db on different hosts.
What matters, is that after few days it started to fail in
pthread_create(), because of memory problems.

And looks like this is causing the problem. Please note that it
happends on both 8.3 and 8.4, in the same way (above backtrace is from
8.4).
Any ideas ?
I call PGconnectdb, and than PQfinish, on that test - it can't connect
because db is down.
Now, I am very sure that PQfinish is called.
Since no connection exists during that test, nothing else is called in libpq.

Any ideas ?

--
GJ

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2009-02-17 13:38:13 Re: leak in libpq, getpwuid
Previous Message Thomas Kellerer 2009-02-17 13:28:38 Re: hi all