For defect 7643 which is described in the following mail, 
http://archives.postgresql.org/message-id/E1TWWd4-0008AD-9E@wrigleys.postgre
sql.org 
  
The problem identified as the postmaster handling SIGUSR1 after SIGINT
signal leads to the problem as 
bgwriter process is not signaled to terminate by the postmaster as it was
not exist during the processing  of 
SIGINT signal and after that during the processing of SIGUSR1 signal the
process got created. 
  
As the postmaster is waiting for the bgwriter process to terminate in the
further shutdown follow leads the postmaster process to wait until the 
Bgwriter process stops, which enters into a deadlock. 
  
The issue is occurring only incase of SIGINT signal and it was handled for
SIGTERM signal as during the processing of 
SIGTERM signal the pmState is modified which blocks the further start of
bgwriter. 
  
The following patch handles the SIGINT signal also the same way as the
SIGTERM signal for the pmState. 
  
*** a/src/backend/postmaster/postmaster.c 
--- b/src/backend/postmaster/postmaster.c 
*************** 
*** 2258,2270 **** pmdie(SIGNAL_ARGS) 
                                  signal_child(BgWriterPID, SIGTERM); 
                          if (WalReceiverPID != 0) 
                                  signal_child(WalReceiverPID, SIGTERM); 
!                         if (pmState == PM_RECOVERY) 
                          { 
-                                 /* 
-                                  * Only startup, bgwriter, and
checkpointer should be active 
-                                  * in this state; we just signaled the
first two, and we don't 
-                                  * want to kill checkpointer yet. 
-                                  */ 
                                  pmState = PM_WAIT_BACKENDS; 
                          } 
                          else if (pmState == PM_RUN || 
--- 2258,2277 ---- 
                                  signal_child(BgWriterPID, SIGTERM); 
                          if (WalReceiverPID != 0) 
                                  signal_child(WalReceiverPID, SIGTERM); 
! 
!                         /* 
!                          * In the case of pmState as PM_STARTUP, to avoid
further startup 
!                          * of bgwriter and checkpointer incase of standby
or in archieve 
!                          * recovery mode because we are already in the
process of handling 
!                          * fast shutdown. 
!                          * 
!                          * In the case of pmState as PM_RECOVERY, only
startup, bgwriter 
!                          * and checkpointer should be active in this
state; we just 
!                          * signaled the first two, and we don't want to
kill checkpointer 
!                          * yet. 
!                          */ 
!                         if (pmState == PM_RECOVERY || pmState ==
PM_STARTUP) 
                          { 
                                  pmState = PM_WAIT_BACKENDS; 
                          } 
                          else if (pmState == PM_RUN || 

Regards, 
Hari babu. 

Reply via email to