[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Branko Čibej <brane_at_apache.org>
Date: Sat, 27 Oct 2018 18:59:06 +0200

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
Received on 2018-10-27 18:59:15 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.