pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
11+ messages / 5 participants
[nested] [flat]

* pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 08:29  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2011-12-12 08:29 UTC (permalink / raw)
  To: pgsql-committers

Revert the behavior of inet/cidr functions to not unpack the arguments.

I forgot to change the functions to use the PG_GETARG_INET_PP() macro,
when I changed DatumGetInetP() to unpack the datum, like Datum*P macros
usually do. Also, I screwed up the definition of the PG_GETARG_INET_PP()
macro, and didn't notice because it wasn't used.

This fixes the memory leak when sorting inet values, as reported
by Jochen Erwied and debugged by Andres Freund. Backpatch to 8.3, like
the previous patch that broke it.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8409b60476a4112e654d1a5099dd67a54f197afd

Modified Files
--------------
src/backend/utils/adt/network.c |   98 +++++++++++++++++++-------------------
src/include/utils/inet.h        |    2 +-
2 files changed, 50 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 08:29  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2011-12-12 08:29 UTC (permalink / raw)
  To: pgsql-committers

Revert the behavior of inet/cidr functions to not unpack the arguments.

I forgot to change the functions to use the PG_GETARG_INET_PP() macro,
when I changed DatumGetInetP() to unpack the datum, like Datum*P macros
usually do. Also, I screwed up the definition of the PG_GETARG_INET_PP()
macro, and didn't notice because it wasn't used.

This fixes the memory leak when sorting inet values, as reported
by Jochen Erwied and debugged by Andres Freund. Backpatch to 8.3, like
the previous patch that broke it.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/6c0a375adf9b27fbb8cab8d5cae5dc6b58ea6b24

Modified Files
--------------
src/backend/utils/adt/network.c |   98 +++++++++++++++++++-------------------
src/include/utils/inet.h        |    2 +-
2 files changed, 50 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 08:29  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2011-12-12 08:29 UTC (permalink / raw)
  To: pgsql-committers

Revert the behavior of inet/cidr functions to not unpack the arguments.

I forgot to change the functions to use the PG_GETARG_INET_PP() macro,
when I changed DatumGetInetP() to unpack the datum, like Datum*P macros
usually do. Also, I screwed up the definition of the PG_GETARG_INET_PP()
macro, and didn't notice because it wasn't used.

This fixes the memory leak when sorting inet values, as reported
by Jochen Erwied and debugged by Andres Freund. Backpatch to 8.3, like
the previous patch that broke it.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/c1a03230b79f1b90a6b28b2cc8fa27c640a915e5

Modified Files
--------------
src/backend/utils/adt/network.c |   98 +++++++++++++++++++-------------------
src/include/utils/inet.h        |    2 +-
2 files changed, 50 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 08:29  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2011-12-12 08:29 UTC (permalink / raw)
  To: pgsql-committers

Revert the behavior of inet/cidr functions to not unpack the arguments.

I forgot to change the functions to use the PG_GETARG_INET_PP() macro,
when I changed DatumGetInetP() to unpack the datum, like Datum*P macros
usually do. Also, I screwed up the definition of the PG_GETARG_INET_PP()
macro, and didn't notice because it wasn't used.

This fixes the memory leak when sorting inet values, as reported
by Jochen Erwied and debugged by Andres Freund. Backpatch to 8.3, like
the previous patch that broke it.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/81f4e6cd27d538bc27e9714a9173e4df353a02e5

Modified Files
--------------
src/backend/utils/adt/network.c |   98 +++++++++++++++++++-------------------
src/include/utils/inet.h        |    2 +-
2 files changed, 50 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 08:29  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 1 reply; 11+ messages in thread

From: Heikki Linnakangas @ 2011-12-12 08:29 UTC (permalink / raw)
  To: pgsql-committers

Revert the behavior of inet/cidr functions to not unpack the arguments.

I forgot to change the functions to use the PG_GETARG_INET_PP() macro,
when I changed DatumGetInetP() to unpack the datum, like Datum*P macros
usually do. Also, I screwed up the definition of the PG_GETARG_INET_PP()
macro, and didn't notice because it wasn't used.

This fixes the memory leak when sorting inet values, as reported
by Jochen Erwied and debugged by Andres Freund. Backpatch to 8.3, like
the previous patch that broke it.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/6cf639dfbddbc44d027730ad1504886312bc905a

Modified Files
--------------
src/backend/utils/adt/network.c |   98 +++++++++++++++++++-------------------
src/include/utils/inet.h        |    2 +-
2 files changed, 50 insertions(+), 50 deletions(-)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 18:37  Andres Freund <andres@anarazel.de>
  parent: Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 1 reply; 11+ messages in thread

From: Andres Freund @ 2011-12-12 18:37 UTC (permalink / raw)
  To: pgsql-committers; Heikki Linnakangas <heikki.linnakangas@iki.fi>; Rafael Martinez <r.m.guerrero@usit.uio.no>; Tom Lane <tgl@sss.pgh.pa.us>

Hi,

On Monday, December 12, 2011 09:29:23 AM Heikki Linnakangas wrote:
> Revert the behavior of inet/cidr functions to not unpack the arguments.
Whats the plan to handle this wrt a stable release? We had one more report of 
this on irc and I got two calls from clients already. And I don't have that 
many clients.
It drives machines to OOM very quickly which isn't exactly good for the 
reputation of pg's stable releases...

I CC'ed the guy reporting the problem on irc.

Andres



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 18:48  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 11+ messages in thread

From: Tom Lane @ 2011-12-12 18:48 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers; Heikki Linnakangas <heikki.linnakangas@iki.fi>; Rafael Martinez <r.m.guerrero@usit.uio.no>

Andres Freund <andres@anarazel.de> writes:
> On Monday, December 12, 2011 09:29:23 AM Heikki Linnakangas wrote:
>> Revert the behavior of inet/cidr functions to not unpack the arguments.

> Whats the plan to handle this wrt a stable release?

I was wondering whether we shouldn't revert the original patch
altogether in the back branches.  As far as I'd heard, there were
no reports of the previous coding causing real trouble, and this
episode demonstrates that there is a possibility to make things
worse rather than better.  I think maybe we'd better treat this
change as something to make in HEAD only.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 18:55  Andres Freund <andres@anarazel.de>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 11+ messages in thread

From: Andres Freund @ 2011-12-12 18:55 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers; Heikki Linnakangas <heikki.linnakangas@iki.fi>; Rafael Martinez <r.m.guerrero@usit.uio.no>

On Monday, December 12, 2011 07:48:01 PM Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On Monday, December 12, 2011 09:29:23 AM Heikki Linnakangas wrote:
> >> Revert the behavior of inet/cidr functions to not unpack the arguments.
> > 
> > Whats the plan to handle this wrt a stable release?
> 
> I was wondering whether we shouldn't revert the original patch
> altogether in the back branches.  As far as I'd heard, there were
> no reports of the previous coding causing real trouble, and this
> episode demonstrates that there is a possibility to make things
> worse rather than better.  I think maybe we'd better treat this
> change as something to make in HEAD only.
+1



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-12 19:53  Rafael Martinez <r.m.guerrero@usit.uio.no>
  parent: Andres Freund <andres@anarazel.de>
  1 sibling, 1 reply; 11+ messages in thread

From: Rafael Martinez @ 2011-12-12 19:53 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers; Heikki Linnakangas <heikki.linnakangas@iki.fi>; r.m.guerrero@usit.uio.no

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/12/2011 07:55 PM, Andres Freund wrote:
> On Monday, December 12, 2011 07:48:01 PM Tom Lane wrote:
>> Andres Freund <andres@anarazel.de> writes:
>>> On Monday, December 12, 2011 09:29:23 AM Heikki Linnakangas wrote:
>>>> Revert the behavior of inet/cidr functions to not unpack the arguments.
>>>
>>> Whats the plan to handle this wrt a stable release?
>>
>> I was wondering whether we shouldn't revert the original patch
>> altogether in the back branches.  As far as I'd heard, there were
>> no reports of the previous coding causing real trouble, and this
>> episode demonstrates that there is a possibility to make things
>> worse rather than better.  I think maybe we'd better treat this
>> change as something to make in HEAD only.
>
> +1

+1

This is a bug that really qualifies for an early 9.1.3.

A simple create index on an inet column almost crashed our production
server and everything got very unresponsive for a while.

The process running the create index grew to over 24GB in a matter of a
few minuttes. We managed to kill the process at the last moment before
going empty for cached memory and swap.

regards,
- -- 
 Rafael Martinez Guerrero
 Center for Information Technology
 University of Oslo, Norway

 PGP Public Key: http://folk.uio.no/rafael/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7mW50ACgkQBhuKQurGihTm8QCgmgIa8GVXfmLDjX68Gu460vZz
yuoAn2grjPPxcyBsVzetxpXJmnK9I0qE
=07YX
-----END PGP SIGNATURE-----



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-13 06:35  Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  parent: Andres Freund <andres@anarazel.de>
  1 sibling, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2011-12-13 06:35 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers; Rafael Martinez <r.m.guerrero@usit.uio.no>

On 12.12.2011 20:55, Andres Freund wrote:
> On Monday, December 12, 2011 07:48:01 PM Tom Lane wrote:
>> Andres Freund<andres@anarazel.de>  writes:
>>> On Monday, December 12, 2011 09:29:23 AM Heikki Linnakangas wrote:
>>>> Revert the behavior of inet/cidr functions to not unpack the arguments.
>>>
>>> Whats the plan to handle this wrt a stable release?
>>
>> I was wondering whether we shouldn't revert the original patch
>> altogether in the back branches.  As far as I'd heard, there were
>> no reports of the previous coding causing real trouble, and this
>> episode demonstrates that there is a possibility to make things
>> worse rather than better.  I think maybe we'd better treat this
>> change as something to make in HEAD only.
> +1

Zoltan's original complaint was real, and he bumped into it in 9.1 and 
9.0. There are few people using these macros in third party code, so I 
doubt we'll hear many reports either way.

The memory leak should be fixed now, and I don't foresee any new issues 
cropping up, so I'm not inclined to revert it anymore. Within PostgreSQL 
itself, I couldn't find any more references to these macros.

If we do revert, I think we should still leave the DatumGetInetPP() 
macro in place. It would be identical to DatumGetInetP(), neither would 
unpack, but DatumGetInetPP() would be the preferred macro to use for 
that purpose.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Revert the behavior of inet/cidr functions to not unpack the arg
@ 2011-12-13 08:58  Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  parent: Rafael Martinez <r.m.guerrero@usit.uio.no>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2011-12-13 08:58 UTC (permalink / raw)
  To: Rafael Martinez <r.m.guerrero@usit.uio.no>; +Cc: Andres Freund <andres@anarazel.de>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers; Heikki Linnakangas <heikki.linnakangas@iki.fi>

On 12.12.2011 21:53, Rafael Martinez wrote:
> On 12/12/2011 07:55 PM, Andres Freund wrote:
>> On Monday, December 12, 2011 07:48:01 PM Tom Lane wrote:
>>> Andres Freund<andres@anarazel.de>  writes:
>>>> On Monday, December 12, 2011 09:29:23 AM Heikki Linnakangas wrote:
>>>>> Revert the behavior of inet/cidr functions to not unpack the arguments.
>>>>
>>>> Whats the plan to handle this wrt a stable release?
>>>
>>> I was wondering whether we shouldn't revert the original patch
>>> altogether in the back branches.  As far as I'd heard, there were
>>> no reports of the previous coding causing real trouble, and this
>>> episode demonstrates that there is a possibility to make things
>>> worse rather than better.  I think maybe we'd better treat this
>>> change as something to make in HEAD only.
>>
>> +1
>
> +1
>
> This is a bug that really qualifies for an early 9.1.3.

Fair enough, but that is a different issue from whether the original 
patch should be reverted altogether. The memory leak has been fixed now, 
in any case.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2011-12-13 08:58 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-12-12 08:29 pgsql: Revert the behavior of inet/cidr functions to not unpack the arg Heikki Linnakangas <heikki.linnakangas@iki.fi>
2011-12-12 08:29 pgsql: Revert the behavior of inet/cidr functions to not unpack the arg Heikki Linnakangas <heikki.linnakangas@iki.fi>
2011-12-12 18:37 ` Andres Freund <andres@anarazel.de>
2011-12-12 18:48   ` Tom Lane <tgl@sss.pgh.pa.us>
2011-12-12 18:55     ` Andres Freund <andres@anarazel.de>
2011-12-12 19:53       ` Rafael Martinez <r.m.guerrero@usit.uio.no>
2011-12-13 08:58         ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-12-13 06:35       ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-12-12 08:29 pgsql: Revert the behavior of inet/cidr functions to not unpack the arg Heikki Linnakangas <heikki.linnakangas@iki.fi>
2011-12-12 08:29 pgsql: Revert the behavior of inet/cidr functions to not unpack the arg Heikki Linnakangas <heikki.linnakangas@iki.fi>
2011-12-12 08:29 pgsql: Revert the behavior of inet/cidr functions to not unpack the arg Heikki Linnakangas <heikki.linnakangas@iki.fi>

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