fixes multi-threaded issue on `__pending` dict (caused due to missing lock on `__pending` dict);

an entry can be deleted by `_delPending` with 1st thread, while 2nd thread in filter doing `_checkPending` where it still got this key in iterator, but later fails in the cycle because `__pending[path]` may be deleted by 1st thread in-between;
closes #3635
pull/3402/merge
sebres 2023-11-22 20:05:02 +01:00
parent 4d603f9726
commit 5d9817728d
1 changed files with 3 additions and 1 deletions

View File

@ -173,7 +173,9 @@ class FilterPyinotify(FileFilter):
if not chkpath(path): # not found - prolong for next time if not chkpath(path): # not found - prolong for next time
if retardTM < 60: retardTM *= 2 if retardTM < 60: retardTM *= 2
if minTime > retardTM: minTime = retardTM if minTime > retardTM: minTime = retardTM
self.__pending[path][0] = retardTM try:
self.__pending[path][0] = retardTM
except KeyError: pass
continue continue
logSys.log(logging.MSG, "Log presence detected for %s %s", logSys.log(logging.MSG, "Log presence detected for %s %s",
"directory" if isDir else "file", path) "directory" if isDir else "file", path)