malnvenshorn / OctoPrint-FilamentManager

OctoPrint plugin to manage your filament inventory
GNU Affero General Public License v3.0
131 stars 59 forks source link

Error while reporting consumed filament #241

Open lettore opened 2 years ago

lettore commented 2 years ago

Describe the bug At the end of the print when the plugin tries to write to the database the consumed length it return an error (psycopg2.OperationalError) server closed the connection unexpectedly. Plugin can access the database and write to it, I can add spools and change the filament in the extruder, I see the changes also in the database so writing is working. It's not clear to me which server closed the connection, on the Postgres side I see no errors. If can be useful I'm using a Postgresql cluster behind Pgpool.

Log file 2022-06-18 22:28:40,353 - octoprint.plugins.filamentmanager - INFO - Updating Filament usage for octoprint configured toolcount: 1 2022-06-18 22:28:40,353 - octoprint.plugins.filamentmanager - INFO - Filament tracked toolcount: 1 2022-06-18 22:28:40,354 - octoprint.plugins.filamentmanager - INFO - Filament tracked values: [1752.2983599999989] 2022-06-18 22:28:40,354 - octoprint.plugins.filamentmanager - INFO - Filament used: 1752.2983599999989 mm (tool0) 2022-06-18 22:28:40,377 - octoprint.plugins.filamentmanager - ERROR - Failed to update filament on tool0: (psycopg2.OperationalError) server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

2022-06-18 22:28:40,378 - octoprint.plugins.filamentmanager - ERROR - Failed to update filament on tool0: (psycopg2.OperationalError) server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. Traceback (most recent call last): File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 721, in _commit_impl self.engine.dialect.do_commit(self.connection) File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 443, in do_commit dbapi_connection.commit() psycopg2.OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_filamentmanager/init.py", line 348, in update_filament_usage selection = self.filamentManager.get_selection(tool, self.client_id) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_filamentmanager/data/init.py", line 303, in get_selection .where((self.selections.c.tool == identifier) & (self.selections.c.client_id == client_id)) File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1647, in exit self.rollback() File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 66, in exit compat.reraise(exc_type, exc_value, exc_tb) File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 187, in reraise raise value File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1644, in exit self.commit() File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1632, in commit self._do_commit() File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1663, in _do_commit self.connection._commit_impl() File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 723, in _commit_impl self._handle_dbapi_exception(e, None, None, None, None) File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception exc_info File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 186, in reraise raise value.with_traceback(tb) File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 721, in _commit_impl self.engine.dialect.do_commit(self.connection) File "/home/pi/oprint/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 443, in do_commit dbapi_connection.commit() sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

2022-06-18 22:28:40,528 - octoprint.plugins.filamentmanager - DEBUG - Updated thresholds: {'tool0': 251362.71456257332}