Error Dictionary changed size during iteration.

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
nobrumski
Newbie
Newbie
Posts: 19
Joined: May 14th, 2010, 9:07 pm

Error Dictionary changed size during iteration.

Post by nobrumski »

Latest release, v1.0.0 running on Win10 - 64. Not sure what happened. I just happened to open the webui and saw the error.

ERROR DURING SCHEDULER EXECUTION dictionary changed size during iteration
Traceback (most recent call last):
File "sabnzbd\utils\kronos.pyo", line 305, in __call__
File "sabnzbd\utils\kronos.pyo", line 399, in execute
File "sabnzbd\bpsmeter.pyo", line 461, in midnight_action
File "sabnzbd\bpsmeter.pyo", line 449, in midnight
RuntimeError: dictionary changed size during iteration
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Error Dictionary changed size during iteration.

Post by sander »

What happens afterwards? Does SAB continue, or does SAB crash & stop?

The relevant code is:

Code: Select all

    def midnight(self):
        """ Midnight action: dummy update for all servers """
        for server in self.day_total:
            self.update(server)
The error comes from this line

Code: Select all

for server in self.day_total:
I think that the for loop starts, and then some other process changes the dictionary length, and the for loop has a problem. If so, this is a race condition.

The error message is reproducible with

Code: Select all

d = {'a': [1], 'b': [1], 'c': [3], 'd':[3333]}
for i in d:
	print i	
	d.pop(i)

Code: Select all

Traceback (most recent call last):
  File "python-dictionary-spelen.py", line 9, in <module>
    for i in d:
RuntimeError: dictionary changed size during iteration
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Error Dictionary changed size during iteration.

Post by shypike »

Could be that servers are switched on or off during a bps cycle.
I'll have a closer look at this.
It must be a very rare error; the code has been like this for many years.
nobrumski
Newbie
Newbie
Posts: 19
Joined: May 14th, 2010, 9:07 pm

Re: Error Dictionary changed size during iteration.

Post by nobrumski »

It didn't seem to affect SABnzbd at all and it has kept working.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Error Dictionary changed size during iteration.

Post by shypike »

It may have caused a crash of the BPS-meter which may have
(at least temporarily) disturbed the speedometer and the download statistics.
Nothing grave, but it should be fixed anyway.
Post Reply