Re: svnpubsub/client.py: RuntimeError: dictionary changed size during iteration

2018-10-27 Thread Branko Čibej
On 23.08.2018 14:54, sebb wrote:
> When running a version of watcher.py I got the following error:
>
>   File ".../svnpubsub/client.py", line 251, in run_forever
> self._check_stale()
>   File ".../svnpubsub/client.py", line 216, in _check_stale
> for client in asyncore.socket_map.values():
> RuntimeError: dictionary changed size during iteration
>
> Is this a known issue?

It is now, since you created #4770 ... :)

Can you try this patch:

Index: client.py
===
--- client.py   (revision 1844264)
+++ client.py   (working copy)
@@ -213,17 +213,19 @@ class MultiClient(object):
 
   def _check_stale(self):
 now = time.time()
+stale = []
 for client in asyncore.socket_map.values():
   if client.last_activity + STALE_DELAY < now:
-# Whoops. No activity in a while. Signal this fact, Close the
-# Client, then have it reconnected later on.
+# Whoops. No activity in a while. Signal this fact.
 self.event_callback(client.url, 'stale', client.last_activity)
+stale.append(client)
 
-# This should remove it from .socket_map.
-client.close()
+# Close stale clients, then have them reconnected later on.
+for client in stale:
+  # This should remove it from .socket_map.
+  client.close()
+  self._reconnect_later(client.url)
 
-self._reconnect_later(client.url)
-
   def _maybe_work(self):
 # If we haven't reach the targetted time, or have no work to do,
 # then fast-path exit






-- Brane



svnpubsub/client.py: RuntimeError: dictionary changed size during iteration

2018-08-23 Thread sebb
When running a version of watcher.py I got the following error:

  File ".../svnpubsub/client.py", line 251, in run_forever
self._check_stale()
  File ".../svnpubsub/client.py", line 216, in _check_stale
for client in asyncore.socket_map.values():
RuntimeError: dictionary changed size during iteration

Is this a known issue?

S.