pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop 6+ messages / 1 participants [nested] [flat]
* pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop @ 2021-03-19 02:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't leak compiled regex(es) when an ispell cache entry is dropped. The text search cache mechanisms assume that we can clean up an invalidated dictionary cache entry simply by resetting the associated long-lived memory context. However, that does not work for ispell affixes that make use of regular expressions, because the regex library deals in plain old malloc. Hence, we leaked compiled regex(es) any time we dropped such a cache entry. That could quickly add up, since even a fairly trivial regex can use up tens of kB, and a large one can eat megabytes. Add a memory context callback to ensure that a regex gets freed when its owning cache entry is cleared. Found via valgrind testing. This problem is ancient, so back-patch to all supported branches. Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/d303849b059c3c315e5a8d4239016f8328f3296c Modified Files -------------- src/backend/tsearch/spell.c | 32 +++++++++++++++++++++++++++++--- src/include/tsearch/dicts/spell.h | 13 ++++++++++++- 2 files changed, 41 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop @ 2021-03-19 02:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't leak compiled regex(es) when an ispell cache entry is dropped. The text search cache mechanisms assume that we can clean up an invalidated dictionary cache entry simply by resetting the associated long-lived memory context. However, that does not work for ispell affixes that make use of regular expressions, because the regex library deals in plain old malloc. Hence, we leaked compiled regex(es) any time we dropped such a cache entry. That could quickly add up, since even a fairly trivial regex can use up tens of kB, and a large one can eat megabytes. Add a memory context callback to ensure that a regex gets freed when its owning cache entry is cleared. Found via valgrind testing. This problem is ancient, so back-patch to all supported branches. Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/eba939551afe5709d15fe7779e7771ae0c8bf830 Modified Files -------------- src/backend/tsearch/spell.c | 34 ++++++++++++++++++++++++++++++---- src/include/tsearch/dicts/spell.h | 13 ++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop @ 2021-03-19 02:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't leak compiled regex(es) when an ispell cache entry is dropped. The text search cache mechanisms assume that we can clean up an invalidated dictionary cache entry simply by resetting the associated long-lived memory context. However, that does not work for ispell affixes that make use of regular expressions, because the regex library deals in plain old malloc. Hence, we leaked compiled regex(es) any time we dropped such a cache entry. That could quickly add up, since even a fairly trivial regex can use up tens of kB, and a large one can eat megabytes. Add a memory context callback to ensure that a regex gets freed when its owning cache entry is cleared. Found via valgrind testing. This problem is ancient, so back-patch to all supported branches. Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/92bc14a1027d9da079264c71329b87e137878845 Modified Files -------------- src/backend/tsearch/spell.c | 34 ++++++++++++++++++++++++++++++---- src/include/tsearch/dicts/spell.h | 13 ++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop @ 2021-03-19 02:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't leak compiled regex(es) when an ispell cache entry is dropped. The text search cache mechanisms assume that we can clean up an invalidated dictionary cache entry simply by resetting the associated long-lived memory context. However, that does not work for ispell affixes that make use of regular expressions, because the regex library deals in plain old malloc. Hence, we leaked compiled regex(es) any time we dropped such a cache entry. That could quickly add up, since even a fairly trivial regex can use up tens of kB, and a large one can eat megabytes. Add a memory context callback to ensure that a regex gets freed when its owning cache entry is cleared. Found via valgrind testing. This problem is ancient, so back-patch to all supported branches. Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/099d2914f30b8c1c9d7aa09a8fa1e1ca3474866e Modified Files -------------- src/backend/tsearch/spell.c | 34 ++++++++++++++++++++++++++++++---- src/include/tsearch/dicts/spell.h | 13 ++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop @ 2021-03-19 02:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't leak compiled regex(es) when an ispell cache entry is dropped. The text search cache mechanisms assume that we can clean up an invalidated dictionary cache entry simply by resetting the associated long-lived memory context. However, that does not work for ispell affixes that make use of regular expressions, because the regex library deals in plain old malloc. Hence, we leaked compiled regex(es) any time we dropped such a cache entry. That could quickly add up, since even a fairly trivial regex can use up tens of kB, and a large one can eat megabytes. Add a memory context callback to ensure that a regex gets freed when its owning cache entry is cleared. Found via valgrind testing. This problem is ancient, so back-patch to all supported branches. Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0b618ddf8bb2fba5492445b56d21647722b8350e Modified Files -------------- src/backend/tsearch/spell.c | 34 ++++++++++++++++++++++++++++++---- src/include/tsearch/dicts/spell.h | 13 ++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop @ 2021-03-19 02:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-19 02:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't leak compiled regex(es) when an ispell cache entry is dropped. The text search cache mechanisms assume that we can clean up an invalidated dictionary cache entry simply by resetting the associated long-lived memory context. However, that does not work for ispell affixes that make use of regular expressions, because the regex library deals in plain old malloc. Hence, we leaked compiled regex(es) any time we dropped such a cache entry. That could quickly add up, since even a fairly trivial regex can use up tens of kB, and a large one can eat megabytes. Add a memory context callback to ensure that a regex gets freed when its owning cache entry is cleared. Found via valgrind testing. This problem is ancient, so back-patch to all supported branches. Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/09e961929614d211405721f070b3db9f1b3f25f4 Modified Files -------------- src/backend/tsearch/spell.c | 34 ++++++++++++++++++++++++++++++---- src/include/tsearch/dicts/spell.h | 13 ++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2021-03-19 02:23 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-03-19 02:23 pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop Tom Lane <tgl@sss.pgh.pa.us> 2021-03-19 02:23 pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop Tom Lane <tgl@sss.pgh.pa.us> 2021-03-19 02:23 pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop Tom Lane <tgl@sss.pgh.pa.us> 2021-03-19 02:23 pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop Tom Lane <tgl@sss.pgh.pa.us> 2021-03-19 02:23 pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop Tom Lane <tgl@sss.pgh.pa.us> 2021-03-19 02:23 pgsql: Don't leak compiled regex(es) when an ispell cache entry is drop 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