*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
***************
*** 2163,2168 **** pmdie(SIGNAL_ARGS)
--- 2163,2183 ----
  			ereport(LOG,
  					(errmsg("received smart shutdown request")));
  
+ 			/*
+ 			 * If there is no WAL file available in the standby, walreceiver
+ 			 * might be invoked before we have reached the PM_RECOVERY state.
+ 			 * In this case, since it's guaranteed that we have no regular
+ 			 * backend, we can kill walreceiver right now and don't need to
+ 			 * switch to the PM_WAIT_READONLY state.
+ 			 */
+ 			if (pmState == PM_INIT || pmState == PM_STARTUP)
+ 			{
+ 				if (StartupPID != 0)
+ 					signal_child(StartupPID, SIGTERM);
+ 				if (WalReceiverPID != 0)
+ 					signal_child(WalReceiverPID, SIGTERM);
+ 			}
+ 
  			if (pmState == PM_RUN || pmState == PM_RECOVERY ||
  				pmState == PM_RECOVERY_CONSISTENT)
  			{
