Skip to content

Commit

Permalink
server: ignore exceptions in the Watcher loop
Browse files Browse the repository at this point in the history
This is a very poor hack, but we don't face exceptions too frequently
here.  Let's restart if e.g. this happens:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
    self.dialect.do_execute(
  File "/usr/lib64/python3.12/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: database is locked

While we ignore such exceptions now, we at least log out the exception
traceback for later analysis.
  • Loading branch information
praiskup committed Jul 15, 2024
1 parent 8370882 commit ffc862e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion resallocserver/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,14 @@ def loop(self):

def run(self):
while True:
self.loop()
try:
self.loop()
except: # pylint: disable=bare-except
# We are a daemon thread that nobody restarts in case of
# unexpected failure, so let's try to recover :shrug:. If the
# parent dies, we get killed without any announcement, sounds
# fair.
app.log.exception("Watcher's logic raised exception, ignoring.")
time.sleep(app.config["sleeptime"] / 2)


Expand Down

0 comments on commit ffc862e

Please sign in to comment.