From: Hiroshi Inoue <inoue@tpf.co.jp>
To: shoji.morimoto@soliton.co.jp
Cc: pgsql-odbc@postgresql.org
Subject: Re: odbc driver leaks memory when connection failed
Date: Wed, 18 Nov 2009 12:27:20 +0900
Message-ID: <4B036998.7020005@tpf.co.jp> (raw)
In-Reply-To: <4B03517A.5060302@soliton.co.jp>
References: <4B03517A.5060302@soliton.co.jp>
shoji.morimoto@soliton.co.jp wrote:
> Hello,
>
> The psotgre odbc driver seems leak memory when connection failed.
Thanks for your report.
I will take care of your suggestion.
> 1) A program tries to connect through odbc to a psotgres server running another machine.
>
> 2) Remove the network cable from the odbc guest machine ( not from the server machine ).
>
> 3) Then memory leaks every time connection fails.
>
> 4) Leak size is small when SSL is OFF and big when SSL is ON. 20 KB to 40 KB each when SSL is ON.
Does the leak occur even when libpq is not called ?
regards,
Hiroshi Inoue
> 5) I tried odbc version 8.3.4 and 8.4.1, and both occurred leak.
>
>
>
> Here I try to guess the cause in the odbc driver source code.
>
> socket.c
>
> SOCK_Destructor(SocketClass *self)
> {
> mylog("SOCK_Destructor\n");
> if (!self)
> return;
> if (self->socket != (SOCKETFD) -1)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I think this part is wrong and unnecessary. It is because...
>
> When LIBPQ_connect failed to connect on some conditions, it leaves :
>
> - self->sock->socket = -1 and..
>
> - selc->sock->pqconn = pqconn ( unfreed. )
>
> --------------------------------------------------
> MORIMOTO Shouji <shoji.morimoto@soliton.co.jp>
> Soliton Systems +81-3-5360-3830 FAX+81-3-5379-0280
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: inoue@tpf.co.jp, shoji.morimoto@soliton.co.jp
Subject: Re: odbc driver leaks memory when connection failed
In-Reply-To: <4B036998.7020005@tpf.co.jp>
References: <4B03517A.5060302@soliton.co.jp> <4B036998.7020005@tpf.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox