pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix snapshot reference leak if lo_export fails.
11+ messages / 4 participants
[nested] [flat]

Commits from this thread:
  2021-11-03 d5ab0681bf f4e3b62710 b7299b6646 7dc9a310e5 b110af5f7c 245799d39c 71aeaf245b  Update alternative expected output file.
* pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 09:44  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 09:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix snapshot reference leak if lo_export fails.

If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.

Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.

Backpatch to all supported versions.

Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7b55bb892a0b3bf5c2e44873d091508eea8bba45

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             | 147 ++++++++++++++---------------
src/backend/storage/large_object/inv_api.c |  36 ++++---
src/test/regress/input/largeobject.source  |  11 +++
src/test/regress/output/largeobject.source |  11 +++
4 files changed, 109 insertions(+), 96 deletions(-)



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

* pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 09:44  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 1 reply; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 09:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix snapshot reference leak if lo_export fails.

If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.

Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.

Backpatch to all supported versions.

Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6b1b405ebfdce9da47f59d8d4144b1168709fbce

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             | 146 ++++++++++++++---------------
src/backend/storage/large_object/inv_api.c |  27 +++---
src/test/regress/input/largeobject.source  |  11 +++
src/test/regress/output/largeobject.source |  11 +++
4 files changed, 104 insertions(+), 91 deletions(-)



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

* pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 09:44  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 09:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix snapshot reference leak if lo_export fails.

If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.

Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.

Backpatch to all supported versions.

Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6bf00da1153607c223cb4cd1be92355233b090ca

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             | 146 ++++++++++++++---------------
src/backend/storage/large_object/inv_api.c |  27 +++---
src/test/regress/input/largeobject.source  |  11 +++
src/test/regress/output/largeobject.source |  11 +++
4 files changed, 104 insertions(+), 91 deletions(-)



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

* pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 09:44  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 09:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix snapshot reference leak if lo_export fails.

If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.

Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.

Backpatch to all supported versions.

Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/11a399f9cfc3854f0029fc4dd355e296a03439f1

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             | 146 ++++++++++++++---------------
src/backend/storage/large_object/inv_api.c |  27 +++---
src/test/regress/input/largeobject.source  |  11 +++
src/test/regress/output/largeobject.source |  11 +++
4 files changed, 104 insertions(+), 91 deletions(-)



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

* pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 09:44  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 09:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix snapshot reference leak if lo_export fails.

If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.

Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.

Backpatch to all supported versions.

Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/07070c0082aacc9e9bf09d1d08bc3a60c999332e

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             | 146 ++++++++++++++---------------
src/backend/storage/large_object/inv_api.c |  27 +++---
src/test/regress/input/largeobject.source  |  11 +++
src/test/regress/output/largeobject.source |  11 +++
4 files changed, 104 insertions(+), 91 deletions(-)



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

* pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 09:44  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 09:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix snapshot reference leak if lo_export fails.

If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.

Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.

Backpatch to all supported versions.

Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8f32afee0179b2050bb1f84ba16fd1d4fba9a3b8

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             | 147 ++++++++++++++---------------
src/backend/storage/large_object/inv_api.c |  36 ++++---
src/test/regress/input/largeobject.source  |  11 +++
src/test/regress/output/largeobject.source |  11 +++
4 files changed, 109 insertions(+), 96 deletions(-)



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

* pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 09:44  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 09:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix snapshot reference leak if lo_export fails.

If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.

Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.

Backpatch to all supported versions.

Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4ebd740cd3f3afe5523c5947be836edf8cccdc27

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             | 146 ++++++++++++++---------------
src/backend/storage/large_object/inv_api.c |  27 +++---
src/test/regress/input/largeobject.source  |  11 +++
src/test/regress/output/largeobject.source |  11 +++
4 files changed, 104 insertions(+), 91 deletions(-)



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

* Re: pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 11:06  Daniel Gustafsson <daniel@yesql.se>
  parent: Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 1 reply; 11+ messages in thread

From: Daniel Gustafsson @ 2021-11-03 11:06 UTC (permalink / raw)
  To: Heikki Linnakangas <heikki.linnakangas@iki.fi>; +Cc: pgsql-committers@lists.postgresql.org

> On 3 Nov 2021, at 10:44, Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote:

> Fix snapshot reference leak if lo_export fails.

This commit seems to lack the update in largeobject_1 as per hamerkop in:

https://brekka.postgresql.org/cgi-bin/show_log.pl?nm=hamerkop&dt=2021-11-03%2010%3A42%3A37

--
Daniel Gustafsson		https://vmware.com/






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

* Re: pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 17:47  Heikki Linnakangas <hlinnaka@iki.fi>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 2 replies; 11+ messages in thread

From: Heikki Linnakangas @ 2021-11-03 17:47 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: pgsql-committers@lists.postgresql.org

On 03/11/2021 13:06, Daniel Gustafsson wrote:
>> On 3 Nov 2021, at 10:44, Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote:
> 
>> Fix snapshot reference leak if lo_export fails.
> 
> This commit seems to lack the update in largeobject_1 as per hamerkop in:

Fixed, thanks!

I'm a bit surprised none of the other Windows systems on the buildfarm 
complained. The difference in largeobject_1 output is apparently that 
the 'tenk.data' file uses Windows line endings. I guess that on all the 
other Windows hosts, git has been configured to use Unix line endings.

- Heikki





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

* Re: pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-03 19:27  Daniel Gustafsson <daniel@yesql.se>
  parent: Heikki Linnakangas <hlinnaka@iki.fi>
  1 sibling, 0 replies; 11+ messages in thread

From: Daniel Gustafsson @ 2021-11-03 19:27 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnaka@iki.fi>; +Cc: pgsql-committers@lists.postgresql.org

> On 3 Nov 2021, at 18:47, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> 
> On 03/11/2021 13:06, Daniel Gustafsson wrote:
>>> On 3 Nov 2021, at 10:44, Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote:
>>> Fix snapshot reference leak if lo_export fails.
>> This commit seems to lack the update in largeobject_1 as per hamerkop in:
> 
> Fixed, thanks!
> 
> I'm a bit surprised none of the other Windows systems on the buildfarm complained. The difference in largeobject_1 output is apparently that the 'tenk.data' file uses Windows line endings. I guess that on all the other Windows hosts, git has been configured to use Unix line endings.

Interesting, so when hamerkop is offline (which it was for a month) we don't
have coverage for Windows line endings? That's worth keeping in mind.

--
Daniel Gustafsson		https://vmware.com/






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

* Re: pgsql: Fix snapshot reference leak if lo_export fails.
@ 2021-11-04 16:31  Andrew Dunstan <andrew@dunslane.net>
  parent: Heikki Linnakangas <hlinnaka@iki.fi>
  1 sibling, 0 replies; 11+ messages in thread

From: Andrew Dunstan @ 2021-11-04 16:31 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnaka@iki.fi>; Daniel Gustafsson <daniel@yesql.se>; +Cc: pgsql-committers@lists.postgresql.org


On 11/3/21 13:47, Heikki Linnakangas wrote:
> On 03/11/2021 13:06, Daniel Gustafsson wrote:
>>> On 3 Nov 2021, at 10:44, Heikki Linnakangas
>>> <heikki.linnakangas@iki.fi> wrote:
>>
>>> Fix snapshot reference leak if lo_export fails.
>>
>> This commit seems to lack the update in largeobject_1 as per hamerkop
>> in:
>
> Fixed, thanks!
>
> I'm a bit surprised none of the other Windows systems on the buildfarm
> complained. The difference in largeobject_1 output is apparently that
> the 'tenk.data' file uses Windows line endings. I guess that on all
> the other Windows hosts, git has been configured to use Unix line
> endings.



no, on drongo this comes up blank:

    git config --get --show-origin core.eol

These days I often set:

    git config --system core.eol lf
    git config --system core.autocrlf input

because it makes repos checked out with Windows native git work nicely
with msys git, but I haven't done that on drongo.



cheers


andrew

-- 

Andrew Dunstan
EDB: https://www.enterprisedb.com






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


end of thread, other threads:[~2021-11-04 16:31 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 09:44 pgsql: Fix snapshot reference leak if lo_export fails. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2021-11-03 11:06 ` Daniel Gustafsson <daniel@yesql.se>
2021-11-03 17:47   ` Heikki Linnakangas <hlinnaka@iki.fi>
2021-11-03 19:27     ` Daniel Gustafsson <daniel@yesql.se>
2021-11-04 16:31     ` Andrew Dunstan <andrew@dunslane.net>
2021-11-03 09:44 pgsql: Fix snapshot reference leak if lo_export fails. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2021-11-03 09:44 pgsql: Fix snapshot reference leak if lo_export fails. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2021-11-03 09:44 pgsql: Fix snapshot reference leak if lo_export fails. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2021-11-03 09:44 pgsql: Fix snapshot reference leak if lo_export fails. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2021-11-03 09:44 pgsql: Fix snapshot reference leak if lo_export fails. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2021-11-03 09:44 pgsql: Fix snapshot reference leak if lo_export fails. 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