public inbox for [email protected]
help / color / mirror / Atom feedFrom: Heikki Linnakangas <[email protected]>
To: Pg Bugs <[email protected]>
Subject: DSA_ALLOC_NO_OOM doesn't work
Date: Mon, 29 Jan 2024 14:06:01 +0200
Message-ID: <[email protected]> (raw)
If you call dsa_allocate_extended(DSA_ALLOC_NO_OOM), it will still
ereport an error if you run out of space (originally reported at [0]).
Attached patch adds code to test_dsa.c to demonstrate that:
postgres=# select test_dsa_basic();
ERROR: could not resize shared memory segment "/PostgreSQL.1312700148"
to 1075843072 bytes: No space left on device
[0] https://github.com/pgvector/pgvector/issues/434#issuecomment-1912744489
--
Heikki Linnakangas
Neon (https://neon.tech)
Attachments:
[text/x-patch] test-DSA_ALLOC_NO_OOM.patch (635B, ../[email protected]/2-test-DSA_ALLOC_NO_OOM.patch)
download | inline diff:
diff --git a/src/test/modules/test_dsa/test_dsa.c b/src/test/modules/test_dsa/test_dsa.c
index 844316dec2b..f37eb57e99d 100644
--- a/src/test/modules/test_dsa/test_dsa.c
+++ b/src/test/modules/test_dsa/test_dsa.c
@@ -51,6 +51,19 @@ test_dsa_basic(PG_FUNCTION_ARGS)
for (int i = 0; i < 100; i++)
{
dsa_free(a, p[i]);
+ p[i] = InvalidDsaPointer;
+ }
+
+ for (int i = 0; i < 100; i++)
+ p[i] = dsa_allocate_extended(a, 1024*1024*1024, DSA_ALLOC_NO_OOM | DSA_ALLOC_HUGE);
+
+ for (int i = 0; i < 100; i++)
+ {
+ if (p[i] != InvalidDsaPointer)
+ {
+ dsa_free(a, p[i]);
+ p[i] = InvalidDsaPointer;
+ }
}
dsa_detach(a);
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: DSA_ALLOC_NO_OOM doesn't work
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox