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

Commit03f06ff

Browse files
committed
Fix some more bugs in signal handlers and process shutdown logic.
WalSndKill was doing things exactly backwards: it should first clearMyWalSnd (to stop signal handlers from touching MyWalSnd->latch),then disown the latch, and only then mark the WalSnd struct unused byclearing its pid field.Also, WalRcvSigUsr1Handler and worker_spi_sighup failed to preserveerrno, which is surely a requirement for any signal handler.Per discussion of recent buildfarm failures. Back-patch as faras the relevant code exists.
1 parente5c22c1 commit03f06ff

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎src/backend/replication/walsender.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -920,17 +920,23 @@ InitWalSnd(void)
920920
staticvoid
921921
WalSndKill(intcode,Datumarg)
922922
{
923-
Assert(MyWalSnd!=NULL);
923+
WalSnd*walsnd=MyWalSnd;
924+
925+
Assert(walsnd!=NULL);
926+
927+
/*
928+
* Clear MyWalSnd first; then disown the latch. This is so that signal
929+
* handlers won't try to touch the latch after it's no longer ours.
930+
*/
931+
MyWalSnd=NULL;
932+
933+
DisownLatch(&walsnd->latch);
924934

925935
/*
926936
* Mark WalSnd struct no longer in use. Assume that no lock is required
927937
* for this.
928938
*/
929-
MyWalSnd->pid=0;
930-
DisownLatch(&MyWalSnd->latch);
931-
932-
/* WalSnd struct isn't mine anymore */
933-
MyWalSnd=NULL;
939+
walsnd->pid=0;
934940
}
935941

936942
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp