Summary
After our postgres database was shutdown for unattended upgrades, defguard terminated and did not automatically start again.
Steps to reproduce
- Terminate the database defguard is configured to use
- Wait for a periodic task which tries to do something in the database (lke the stats purge or the peer disconnect)
- Defguard terminates with a exit code 0.
Expected behavior
We expected that Defguard returns a non-zero exit code and that systemd therefore automatically starts again in such a case (the provided systemd unit has Restart=on-failure defined).
Actual behavior
After our postgres database was shutdown for unattended upgrades, defguard terminated and did not automatically start again.
Defguard version
Core: v1.6.1
Environment details
Debian 13
Deployment / install method
Standalone packages
Relevant logs / output
defguard.service: Deactivated successfully.
2026-03-15T05:33:23.527348Z ERROR defguard: message=Periodic peer disconnect task returned early: Err(DbError(Database(PgDatabaseError { severity: Fatal, code: "57P01", message: "terminating connection due to administrator command", detail: None, hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("postgres.c"), line: Some(3315), routine: Some("ProcessInterrupts") }))) [1.6.1+d810a59 Debian 13.0.0 x86_64]
2026-03-15T05:33:23.485862Z ERROR run_utility_thread: defguard_core::utility_thread: message=There was an error while performing directory sync job: DbError(Io(Custom { kind: UnexpectedEof, error: "expected to read 5 bytes, got 0 bytes at EOF" })) [1.6.1+d810a59 Debian 13.0.0 x86_64]
Relevant configuration (redacted)
Summary
After our postgres database was shutdown for unattended upgrades, defguard terminated and did not automatically start again.
Steps to reproduce
Expected behavior
We expected that Defguard returns a non-zero exit code and that systemd therefore automatically starts again in such a case (the provided systemd unit has
Restart=on-failuredefined).Actual behavior
After our postgres database was shutdown for unattended upgrades, defguard terminated and did not automatically start again.
Defguard version
Core: v1.6.1
Environment details
Debian 13
Deployment / install method
Standalone packages
Relevant logs / output
defguard.service: Deactivated successfully. 2026-03-15T05:33:23.527348Z ERROR defguard: message=Periodic peer disconnect task returned early: Err(DbError(Database(PgDatabaseError { severity: Fatal, code: "57P01", message: "terminating connection due to administrator command", detail: None, hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("postgres.c"), line: Some(3315), routine: Some("ProcessInterrupts") }))) [1.6.1+d810a59 Debian 13.0.0 x86_64] 2026-03-15T05:33:23.485862Z ERROR run_utility_thread: defguard_core::utility_thread: message=There was an error while performing directory sync job: DbError(Io(Custom { kind: UnexpectedEof, error: "expected to read 5 bytes, got 0 bytes at EOF" })) [1.6.1+d810a59 Debian 13.0.0 x86_64]Relevant configuration (redacted)