PostgreSQL won't start after Windows update restarts
<p>I have a Windows 2012R2 server with PostgreSQL 9.3.4 x64 installed as a service. It seems like everytime the server perform a Windows update and finally restart, the PostgreSQL service fail to start again. Here's the PostgreSQL log before the restart:</p>

<blockquote>
  <p>LOG:  received fast shutdown request<BR>
  LOG:  aborting any active transactions<BR>
  FATAL:  terminating connection due to administrator command<BR>
  FATAL:  terminating connection due to administrator command<BR>
  FATAL:  terminating connection due to administrator command<BR>
  FATAL:  terminating connection due to administrator command<BR>
  FATAL:  terminating connection due to administrator command<BR>
  FATAL:  terminating connection due to administrator command<BR>
  LOG:  autovacuum launcher shutting down<BR>
  ERROR:  canceling statement due to user request<BR>
  LOG:  autovacuum launcher shutting down</p>
</blockquote>

<p>After the restart I have several <code>postgres.exe</code> instances running on the server and the database folder contains a <code>postmaster.pid</code> which is not empty. The PostgreSQL log after restart contains the following:</p>

<blockquote>
  <p>FATAL:  the database system is starting up<BR>
  LOG:  database system was interrupted; last known up at 2016-04-09 02:31:22 CEST<BR>
  LOG:  database system was not properly shut down; automatic recovery in progress<BR>
  LOG:  record with zero length at D2/9C630820<BR>
  LOG:  redo is not required<BR>
  FATAL:  the database system is starting up<BR>
  FATAL:  the database system is starting up<BR>
  ...<BR>
  FATAL:  the database system is starting up</p>
</blockquote>

<p>Since the database is normally used for <em>readonly</em> purposes I guess I probably won't experience database corruption.</p>

<p>So far I can manually force the <code>postgres.exe</code> instances to shut down (though I have just one instance, which gives me <em>Access denied</em> when I perform an <em>End process</em> on it), delete the <code>postmaster.pid</code> file and then restart the PostgreSQL service. The service seem to start okay even though I have the rogue <code>postgres.exe</code> instance still running. </p>

<p>What could be the reason for Windows and PostgreSQL to struggle like this?</p>