Shared memory leak on DSM slot exhaustion

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Shared memory leak on DSM slot exhaustion
Date: 2020-01-30 09:53:38
Message-ID: CA+hUKGKAAoEw-R4om0d2YM4eqT1eGEi6=Qot-3ceDR-SLiWVDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

As reported over on pgsql-general[1], we leak shared memory when we
run out of DSM slots. To see this, add the random-run-out-of-slots
hack I showed in that thread, create and analyze a table t(i) with a
million integers, run with dynamic_shared_memory_type=mmap, and try
SELECT COUNT(*) FROM t t1 JOIN t t2 USING (i) a few times and you'll
see that pgbase/pg_dynshmem fills up with leaked memory segments each
time an out-of-slots errors is raised. (It happens with all DSM
types, but then the way to list the segments varies or there isn't
one, depending on type and OS.) Here's a draft patch to fix that.

[1] https://www.postgresql.org/message-id/CA%2BhUKG%2Bzw87b70yJp%2BOzz6LqS6s9QvdO4%2BhQuZc%3DDWLMi6Od6A%40mail.gmail.com

Attachment Content-Type Size
0001-Fix-memory-leak-on-DSM-slot-exhaustion.patch application/octet-stream 1.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2020-01-30 10:02:18 Re: [Proposal] Global temporary tables
Previous Message Pavel Stehule 2020-01-30 09:52:56 Re: [Proposal] Global temporary tables