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

Commit81b116d

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 parentfad4437 commit81b116d

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
@@ -950,17 +950,23 @@ InitWalSnd(void)
950950
staticvoid
951951
WalSndKill(intcode,Datumarg)
952952
{
953-
Assert(MyWalSnd!=NULL);
953+
WalSnd*walsnd=MyWalSnd;
954+
955+
Assert(walsnd!=NULL);
956+
957+
/*
958+
* Clear MyWalSnd first; then disown the latch. This is so that signal
959+
* handlers won't try to touch the latch after it's no longer ours.
960+
*/
961+
MyWalSnd=NULL;
962+
963+
DisownLatch(&walsnd->latch);
954964

955965
/*
956966
* Mark WalSnd struct no longer in use. Assume that no lock is required
957967
* for this.
958968
*/
959-
MyWalSnd->pid=0;
960-
DisownLatch(&MyWalSnd->latch);
961-
962-
/* WalSnd struct isn't mine anymore */
963-
MyWalSnd=NULL;
969+
walsnd->pid=0;
964970
}
965971

966972
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp