Logger with postgresql... retry/reconnect logic
Posted: Sat Sep 28, 2019 12:27 pm
Postgresql doesn't like being hard rebooted after power failures and UPSes don't always cover entire outages, so occasionally things come back up in a bad state.
Recovering postgres from the most common failure mode (.pid not getting deleted upon system restart) is pretty easy to automate. But once the indigo Logger plugin gets stuck, the only way to 'unstick' it is to disable/renable the plugin.
The failure is reflected in the logs as repeated broken pipe messages. If the plugin would detect repeated broken pipes and attempt to automatically recreate the connection it would be more robust.
Recovering postgres from the most common failure mode (.pid not getting deleted upon system restart) is pretty easy to automate. But once the indigo Logger plugin gets stuck, the only way to 'unstick' it is to disable/renable the plugin.
The failure is reflected in the logs as repeated broken pipe messages. If the plugin would detect repeated broken pipes and attempt to automatically recreate the connection it would be more robust.
- Code: Select all
SQL Logger Error exception trying to insert row into table variable_history_1045860997 ("Unifi_Count_ALL_lastChange")
SQL Logger Error [Errno 32] Broken pipe
SQL Logger Error INSERT INTO variable_history_1045860997 (value) VALUES (%s);
SQL Logger Error exception trying to insert row into table variable_history_1012734241 ("Unifi_Count_ALL_Home")
SQL Logger Error [Errno 32] Broken pipe
SQL Logger Error INSERT INTO variable_history_1012734241 (value) VALUES (%s);
SQL Logger Error exception trying to insert row into table variable_history_97248977 ("Unifi_Count_ALL_Away")
SQL Logger Error [Errno 32] Broken pipe