Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f0019d

Browse files
committed
Don't leak a signalfd when using latches in the postmaster.
At the time of commit6a2a70a we didn't use latch infrastructure inthe postmaster. We're planning to start doing that, so we'd better makesure that the signalfd inherited from a postmaster is not duplicated andthen leaked in the child.Reviewed-by: Andres Freund <andres@anarazel.de>Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>Discussion:https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com
1 parent30829e5 commit1f0019d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎src/backend/storage/ipc/latch.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,22 @@ InitializeLatchSupport(void)
283283
#ifdefWAIT_USE_SIGNALFD
284284
sigset_tsignalfd_mask;
285285

286+
if (IsUnderPostmaster)
287+
{
288+
/*
289+
* It would probably be safe to re-use the inherited signalfd since
290+
* signalfds only see the current process's pending signals, but it
291+
* seems less surprising to close it and create our own.
292+
*/
293+
if (signal_fd!=-1)
294+
{
295+
/* Release postmaster's signal FD; ignore any error */
296+
(void)close(signal_fd);
297+
signal_fd=-1;
298+
ReleaseExternalFD();
299+
}
300+
}
301+
286302
/* Block SIGURG, because we'll receive it through a signalfd. */
287303
sigaddset(&UnBlockSig,SIGURG);
288304

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp