pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix bogus "out of memory" reports in tuplestore.c. 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix bogus "out of memory" reports in tuplestore.c. @ 2015-08-04 22:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-04 22:19 UTC (permalink / raw) To: pgsql-committers Fix bogus "out of memory" reports in tuplestore.c. The tuplesort/tuplestore memory management logic assumed that the chunk allocation overhead for its memtuples array could not increase when increasing the array size. This is and always was true for tuplesort, but we (I, I think) blindly copied that logic into tuplestore.c without noticing that the assumption failed to hold for the much smaller array elements used by tuplestore. Given rather small work_mem, this could result in an improper complaint about "unexpected out-of-memory situation", as reported by Brent DeSpain in bug #13530. The easiest way to fix this is just to increase tuplestore's initial array size so that the assumption holds. Rather than relying on magic constants, though, let's export a #define from aset.c that represents the safe allocation threshold, and make tuplestore's calculation depend on that. Do the same in tuplesort.c to keep the logic looking parallel, even though tuplesort.c isn't actually at risk at present. This will keep us from breaking it if we ever muck with the allocation parameters in aset.c. Back-patch to all supported versions. The error message doesn't occur pre-9.3, not so much because the problem can't happen as because the pre-9.3 tuplestore code neglected to check for it. (The chance of trouble is a great deal larger as of 9.3, though, due to changes in the array-size-increasing strategy.) However, allowing LACKMEM() to become true unexpectedly could still result in less-than-desirable behavior, so let's patch it all the way back. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/8ea3e7a75c0d22c41c57f59c8b367059b97d0b66 Modified Files -------------- src/backend/utils/mmgr/aset.c | 11 ++++++++--- src/backend/utils/sort/tuplesort.c | 19 +++++++++++++------ src/backend/utils/sort/tuplestore.c | 19 +++++++++++++------ src/include/utils/memutils.h | 8 ++++++++ 4 files changed, 42 insertions(+), 15 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix bogus "out of memory" reports in tuplestore.c. @ 2015-08-04 22:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-04 22:19 UTC (permalink / raw) To: pgsql-committers Fix bogus "out of memory" reports in tuplestore.c. The tuplesort/tuplestore memory management logic assumed that the chunk allocation overhead for its memtuples array could not increase when increasing the array size. This is and always was true for tuplesort, but we (I, I think) blindly copied that logic into tuplestore.c without noticing that the assumption failed to hold for the much smaller array elements used by tuplestore. Given rather small work_mem, this could result in an improper complaint about "unexpected out-of-memory situation", as reported by Brent DeSpain in bug #13530. The easiest way to fix this is just to increase tuplestore's initial array size so that the assumption holds. Rather than relying on magic constants, though, let's export a #define from aset.c that represents the safe allocation threshold, and make tuplestore's calculation depend on that. Do the same in tuplesort.c to keep the logic looking parallel, even though tuplesort.c isn't actually at risk at present. This will keep us from breaking it if we ever muck with the allocation parameters in aset.c. Back-patch to all supported versions. The error message doesn't occur pre-9.3, not so much because the problem can't happen as because the pre-9.3 tuplestore code neglected to check for it. (The chance of trouble is a great deal larger as of 9.3, though, due to changes in the array-size-increasing strategy.) However, allowing LACKMEM() to become true unexpectedly could still result in less-than-desirable behavior, so let's patch it all the way back. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/e2035dc9a7a8056eab7c33a1c677cd25312eb312 Modified Files -------------- src/backend/utils/mmgr/aset.c | 11 ++++++++--- src/backend/utils/sort/tuplesort.c | 19 +++++++++++++------ src/backend/utils/sort/tuplestore.c | 19 +++++++++++++------ src/include/utils/memutils.h | 8 ++++++++ 4 files changed, 42 insertions(+), 15 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix bogus "out of memory" reports in tuplestore.c. @ 2015-08-04 22:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-04 22:19 UTC (permalink / raw) To: pgsql-committers Fix bogus "out of memory" reports in tuplestore.c. The tuplesort/tuplestore memory management logic assumed that the chunk allocation overhead for its memtuples array could not increase when increasing the array size. This is and always was true for tuplesort, but we (I, I think) blindly copied that logic into tuplestore.c without noticing that the assumption failed to hold for the much smaller array elements used by tuplestore. Given rather small work_mem, this could result in an improper complaint about "unexpected out-of-memory situation", as reported by Brent DeSpain in bug #13530. The easiest way to fix this is just to increase tuplestore's initial array size so that the assumption holds. Rather than relying on magic constants, though, let's export a #define from aset.c that represents the safe allocation threshold, and make tuplestore's calculation depend on that. Do the same in tuplesort.c to keep the logic looking parallel, even though tuplesort.c isn't actually at risk at present. This will keep us from breaking it if we ever muck with the allocation parameters in aset.c. Back-patch to all supported versions. The error message doesn't occur pre-9.3, not so much because the problem can't happen as because the pre-9.3 tuplestore code neglected to check for it. (The chance of trouble is a great deal larger as of 9.3, though, due to changes in the array-size-increasing strategy.) However, allowing LACKMEM() to become true unexpectedly could still result in less-than-desirable behavior, so let's patch it all the way back. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/118c9bb8d14ebfcbb4a0a4af6f029d8d8fe46ad6 Modified Files -------------- src/backend/utils/mmgr/aset.c | 11 ++++++++--- src/backend/utils/sort/tuplesort.c | 19 +++++++++++++------ src/backend/utils/sort/tuplestore.c | 19 +++++++++++++------ src/include/utils/memutils.h | 8 ++++++++ 4 files changed, 42 insertions(+), 15 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix bogus "out of memory" reports in tuplestore.c. @ 2015-08-04 22:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-04 22:19 UTC (permalink / raw) To: pgsql-committers Fix bogus "out of memory" reports in tuplestore.c. The tuplesort/tuplestore memory management logic assumed that the chunk allocation overhead for its memtuples array could not increase when increasing the array size. This is and always was true for tuplesort, but we (I, I think) blindly copied that logic into tuplestore.c without noticing that the assumption failed to hold for the much smaller array elements used by tuplestore. Given rather small work_mem, this could result in an improper complaint about "unexpected out-of-memory situation", as reported by Brent DeSpain in bug #13530. The easiest way to fix this is just to increase tuplestore's initial array size so that the assumption holds. Rather than relying on magic constants, though, let's export a #define from aset.c that represents the safe allocation threshold, and make tuplestore's calculation depend on that. Do the same in tuplesort.c to keep the logic looking parallel, even though tuplesort.c isn't actually at risk at present. This will keep us from breaking it if we ever muck with the allocation parameters in aset.c. Back-patch to all supported versions. The error message doesn't occur pre-9.3, not so much because the problem can't happen as because the pre-9.3 tuplestore code neglected to check for it. (The chance of trouble is a great deal larger as of 9.3, though, due to changes in the array-size-increasing strategy.) However, allowing LACKMEM() to become true unexpectedly could still result in less-than-desirable behavior, so let's patch it all the way back. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/8bd45a394958c3fd7400654439ef2a113043f8f5 Modified Files -------------- src/backend/utils/mmgr/aset.c | 11 ++++++++--- src/backend/utils/sort/tuplesort.c | 19 +++++++++++++------ src/backend/utils/sort/tuplestore.c | 19 +++++++++++++------ src/include/utils/memutils.h | 8 ++++++++ 4 files changed, 42 insertions(+), 15 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix bogus "out of memory" reports in tuplestore.c. @ 2015-08-04 22:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-04 22:19 UTC (permalink / raw) To: pgsql-committers Fix bogus "out of memory" reports in tuplestore.c. The tuplesort/tuplestore memory management logic assumed that the chunk allocation overhead for its memtuples array could not increase when increasing the array size. This is and always was true for tuplesort, but we (I, I think) blindly copied that logic into tuplestore.c without noticing that the assumption failed to hold for the much smaller array elements used by tuplestore. Given rather small work_mem, this could result in an improper complaint about "unexpected out-of-memory situation", as reported by Brent DeSpain in bug #13530. The easiest way to fix this is just to increase tuplestore's initial array size so that the assumption holds. Rather than relying on magic constants, though, let's export a #define from aset.c that represents the safe allocation threshold, and make tuplestore's calculation depend on that. Do the same in tuplesort.c to keep the logic looking parallel, even though tuplesort.c isn't actually at risk at present. This will keep us from breaking it if we ever muck with the allocation parameters in aset.c. Back-patch to all supported versions. The error message doesn't occur pre-9.3, not so much because the problem can't happen as because the pre-9.3 tuplestore code neglected to check for it. (The chance of trouble is a great deal larger as of 9.3, though, due to changes in the array-size-increasing strategy.) However, allowing LACKMEM() to become true unexpectedly could still result in less-than-desirable behavior, so let's patch it all the way back. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/b6659a3b9eead7e2a2e8eee6152720ec803b5ac2 Modified Files -------------- src/backend/utils/mmgr/aset.c | 10 +++++++--- src/backend/utils/sort/tuplesort.c | 11 +++++++++-- src/backend/utils/sort/tuplestore.c | 11 ++++++++++- src/include/utils/memutils.h | 8 ++++++++ 4 files changed, 34 insertions(+), 6 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix bogus "out of memory" reports in tuplestore.c. @ 2015-08-04 22:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-04 22:19 UTC (permalink / raw) To: pgsql-committers Fix bogus "out of memory" reports in tuplestore.c. The tuplesort/tuplestore memory management logic assumed that the chunk allocation overhead for its memtuples array could not increase when increasing the array size. This is and always was true for tuplesort, but we (I, I think) blindly copied that logic into tuplestore.c without noticing that the assumption failed to hold for the much smaller array elements used by tuplestore. Given rather small work_mem, this could result in an improper complaint about "unexpected out-of-memory situation", as reported by Brent DeSpain in bug #13530. The easiest way to fix this is just to increase tuplestore's initial array size so that the assumption holds. Rather than relying on magic constants, though, let's export a #define from aset.c that represents the safe allocation threshold, and make tuplestore's calculation depend on that. Do the same in tuplesort.c to keep the logic looking parallel, even though tuplesort.c isn't actually at risk at present. This will keep us from breaking it if we ever muck with the allocation parameters in aset.c. Back-patch to all supported versions. The error message doesn't occur pre-9.3, not so much because the problem can't happen as because the pre-9.3 tuplestore code neglected to check for it. (The chance of trouble is a great deal larger as of 9.3, though, due to changes in the array-size-increasing strategy.) However, allowing LACKMEM() to become true unexpectedly could still result in less-than-desirable behavior, so let's patch it all the way back. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/9965aff1ca7ec0f6218ff845a47eeac34f44c425 Modified Files -------------- src/backend/utils/mmgr/aset.c | 10 +++++++--- src/backend/utils/sort/tuplesort.c | 11 +++++++++-- src/backend/utils/sort/tuplestore.c | 11 ++++++++++- src/include/utils/memutils.h | 8 ++++++++ 4 files changed, 34 insertions(+), 6 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix bogus "out of memory" reports in tuplestore.c. @ 2015-08-04 22:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-08-04 22:19 UTC (permalink / raw) To: pgsql-committers Fix bogus "out of memory" reports in tuplestore.c. The tuplesort/tuplestore memory management logic assumed that the chunk allocation overhead for its memtuples array could not increase when increasing the array size. This is and always was true for tuplesort, but we (I, I think) blindly copied that logic into tuplestore.c without noticing that the assumption failed to hold for the much smaller array elements used by tuplestore. Given rather small work_mem, this could result in an improper complaint about "unexpected out-of-memory situation", as reported by Brent DeSpain in bug #13530. The easiest way to fix this is just to increase tuplestore's initial array size so that the assumption holds. Rather than relying on magic constants, though, let's export a #define from aset.c that represents the safe allocation threshold, and make tuplestore's calculation depend on that. Do the same in tuplesort.c to keep the logic looking parallel, even though tuplesort.c isn't actually at risk at present. This will keep us from breaking it if we ever muck with the allocation parameters in aset.c. Back-patch to all supported versions. The error message doesn't occur pre-9.3, not so much because the problem can't happen as because the pre-9.3 tuplestore code neglected to check for it. (The chance of trouble is a great deal larger as of 9.3, though, due to changes in the array-size-increasing strategy.) However, allowing LACKMEM() to become true unexpectedly could still result in less-than-desirable behavior, so let's patch it all the way back. Branch ------ REL9_0_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/bd327627f6c0a8acb2674aea8ccb2ecb776345f4 Modified Files -------------- src/backend/utils/mmgr/aset.c | 7 ++++++- src/backend/utils/sort/tuplesort.c | 11 +++++++++-- src/backend/utils/sort/tuplestore.c | 11 ++++++++++- src/include/utils/memutils.h | 8 ++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2015-08-04 22:19 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-08-04 22:19 pgsql: Fix bogus "out of memory" reports in tuplestore.c. Tom Lane <tgl@sss.pgh.pa.us> 2015-08-04 22:19 pgsql: Fix bogus "out of memory" reports in tuplestore.c. Tom Lane <tgl@sss.pgh.pa.us> 2015-08-04 22:19 pgsql: Fix bogus "out of memory" reports in tuplestore.c. Tom Lane <tgl@sss.pgh.pa.us> 2015-08-04 22:19 pgsql: Fix bogus "out of memory" reports in tuplestore.c. Tom Lane <tgl@sss.pgh.pa.us> 2015-08-04 22:19 pgsql: Fix bogus "out of memory" reports in tuplestore.c. Tom Lane <tgl@sss.pgh.pa.us> 2015-08-04 22:19 pgsql: Fix bogus "out of memory" reports in tuplestore.c. Tom Lane <tgl@sss.pgh.pa.us> 2015-08-04 22:19 pgsql: Fix bogus "out of memory" reports in tuplestore.c. Tom Lane <tgl@sss.pgh.pa.us>
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