Thread: Windows service randomly stops with no indication why
Running PostgreSQL 15.6 on Windows Server 2022. The database service randomly just stops and the Windows Service auto-restart options don't kick in. The stop is unexpected (not a controlled shut down) because after restarting the service the postgresql log states that the database system was interrupted, not properly shut down, and automatic recovery in progress. There's nothing to indicate exactly when it went down, other than the timestamp of the last log entry before restarting it.
There's also nothing I could find in the Windows Event Logs other than when the service is started each time.
This is occurring at random times, day or night, around 0 to 2 times each day.
Any clue as to what's happening or how to investigate this further?
Thanks,
Jay
On Fri, Mar 8, 2024 at 9:17 AM Jay Madren <jay@jaymadren.com> wrote:
Running PostgreSQL 15.6 on Windows Server 2022. The database service randomly just stops and the Windows Service auto-restart options don't kick in. The stop is unexpected (not a controlled shut down) because after restarting the service the postgresql log states that the database system was interrupted, not properly shut down, and automatic recovery in progress. There's nothing to indicate exactly when it went down, other than the timestamp of the last log entry before restarting it.There's also nothing I could find in the Windows Event Logs other than when the service is started each time.This is occurring at random times, day or night, around 0 to 2 times each day.Any clue as to what's happening or how to investigate this further?
What is log_min_messages set to? Increasing it might shed some light.
Go to "Services", find Postgres, and try a manual restart, see what happens. Then check the recovery tab and see what it is supposed to do on failures - you are probably at the "Do nothing" count limit, hence the no auto restart.
If you can manually duplicate the failure to restart, try increasing the logging, removing extensions, simplifying the postgresql.conf, etc, until it starts working again. I suspect it will restart fine, though. Maybe check anti-virus software logs?
Cheers,
Greg
On 08/03/2024 14:17, Jay Madren wrote:
Running PostgreSQL 15.6 on Windows Server 2022. The database service randomly just stops and the Windows Service auto-restart options don't kick in. The stop is unexpected (not a controlled shut down) because after restarting the service the postgresql log states that the database system was interrupted, not properly shut down, and automatic recovery in progress. There's nothing to indicate exactly when it went down, other than the timestamp of the last log entry before restarting it.There's also nothing I could find in the Windows Event Logs other than when the service is started each time.This is occurring at random times, day or night, around 0 to 2 times each day.Any clue as to what's happening or how to investigate this further?
I haven't used Windows in a very long time, but from (dim and distant) memory PostgreSQL on Windows maintains its own log files, separate to the Windows event log - you may find more clues there.
Ray.
-- Raymond O'Donnell // Galway // Ireland ray@rodonnell.ie
On 3/8/24 06:17, Jay Madren wrote: > Running PostgreSQL 15.6 on Windows Server 2022. The database service > randomly just stops and the Windows Service auto-restart options don't > kick in. The stop is unexpected (not a controlled shut down) because > after restarting the service the postgresql log states that the database > system was interrupted, not properly shut down, and automatic recovery > in progress. There's nothing to indicate exactly when it went down, > other than the timestamp of the last log entry before restarting it. I see this sort of thing on Windows I immediately suspect Anti-Virus software. Verify whether you have AV software running and if it is that it is scanning the Postgres files. > > There's also nothing I could find in the Windows Event Logs other than > when the service is started each time. > > This is occurring at random times, day or night, around 0 to 2 times > each day. > > Any clue as to what's happening or how to investigate this further? > > Thanks, > Jay -- Adrian Klaver adrian.klaver@aklaver.com
> What is log_min_messages set to? Increasing it might shed some light.
It is not set (commented out). I assume the default is "warning". I will set it to "info" and see if that reveals anything.
> Then check the recovery tab and see what it is supposed to do on failures - you are probably at the "Do nothing" count limit, hence the no auto restart.
I had already changed the recovery options to restart on first and second, then run a command script that starts it on the third count. None of them appear to work, which means the shutdown appears to be "normal" to Windows. Or maybe postgres doesn't set exit levels for Windows to act on.
> I see this sort of thing on Windows I immediately suspect Anti-Virus software.
This is what I suspect also. This server was recently "taken over" by a third-party management firm that corporate dictated, and they have loaded all kinds of monitoring and security crap on it. I have reached out to them but not gotten a response. I will push harder on this.
Thanks,
Jay