scline/llama-sd

Thread locking dictionary is not functioning

Closed this issue · 0 comments

When writing to the the dictionary variable the secondary cleanup thread errors if updated at the same time.

Exception in thread CleanThread:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/app/./app.py", line 128, in clean_stale_probes
    for probe in database:
RuntimeError: dictionary changed size during iteration
  1. Catch error so when less busy other runs will work, or restart when thread is dead
  2. Lock dictionary from editing/main until cleanup is completed. If locked gracefully hold or reject connections.