pyfilesystem icon indicating copy to clipboard operation
pyfilesystem copied to clipboard

Race condition in PollingWatchableFS -- needs a lock

Open GoogleCodeExporter opened this issue 10 years ago • 0 comments

What steps will reproduce the problem?
1. The callbacks self._on_path_modify, self._on_path_delete may be called in 
multiple threads -- both any thread using the filesystem as well as from the 
polling thread.
2. What will typically happen is a RuntimeError at 
https://code.google.com/p/pyfilesystem/source/browse/trunk/fs/watch.py#577 
'dictionary changed size during iteration'.

What is the expected output? What do you see instead?
It's a threading issue / race condition


What version of the product are you using? On what operating system?
0.5.0 linux

Please provide any additional information below.

I'm using a stripped-down version of the same class and added a lock -- 
threading.RLock -- around every use of self._path_info. That's my recommended 
solution.


Original issue reported on code.google.com by [email protected] on 9 Dec 2014 at 9:14

GoogleCodeExporter avatar Apr 11 '15 10:04 GoogleCodeExporter