Opened 9 months ago

Closed 8 months ago

#32552 closed defect (duplicate)

stem says "dictionary keys changed during iteration" with python 3.8

Reported by: cypherpunks Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Nyx Version: Tor:
Severity: Normal Keywords:
Cc: atagar Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Every single time I try to connect to for from Nyx I get
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/stem/", line 370, in _connect_auth authenticate(control_socket, password, chroot_path) File "/usr/lib/python3.8/site-packages/stem/", line 625, in authenticate raise auth_exc stem.connection.MissingPassword: no passphrase provided During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/bin/nyx", line 11, in <module> load_entry_point('nyx==2.1.0', 'console_scripts', 'nyx')() File "/usr/lib/python3.8/site-packages/nyx/", line 176, in main nyx.starter.main() File "/usr/lib/python3.8/site-packages/stem/util/", line 289, in wrapped return func(*args, config = config, **kwargs) File "/usr/lib/python3.8/site-packages/nyx/", line 90, in main controller = init_controller( File "/usr/lib/python3.8/site-packages/nyx/", line 325, in init_controller TOR_CONTROLLER = stem.connection.connect(*args, **kwargs) File "/usr/lib/python3.8/site-packages/stem/", line 291, in connect return _connect_auth(control_connection, password, password_prompt, chroot_path, controller) File "/usr/lib/python3.8/site-packages/stem/", line 404, in _connect_auth return _connect_auth(control_socket, password, password_prompt, chroot_path, controller) File "/usr/lib/python3.8/site-packages/stem/", line 375, in _connect_auth return controller(control_socket, is_authenticated = True) File "/usr/lib/python3.8/site-packages/stem/", line 1057, in __init__ super(Controller, self).__init__(control_socket, is_authenticated) File "/usr/lib/python3.8/site-packages/stem/", line 585, in __init__ self._post_authentication() File "/usr/lib/python3.8/site-packages/stem/", line 3902, in _post_authentication owning_pid = self.get_conf('__OwningControllerProcess', None) File "/usr/lib/python3.8/site-packages/stem/", line 2170, in get_conf entries = self.get_conf_map(param, default, multiple) File "/usr/lib/python3.8/site-packages/stem/", line 2273, in get_conf_map for key in reply: RuntimeError: dictionary keys changed during iteration

Using Arch Linux on a headless server, python 3.8.0b4. Tried both cookie and password authentication methods. Controlport is 9051, inaccessible from outside (firewall set up to allow any internal connections to any port)

Child Tickets

#32566closedatagarnyx not startingArchived/Nyx

Change History (11)

comment:1 Changed 9 months ago by cypherpunks

*can't connect to tor not for

comment:2 Changed 9 months ago by arma

Cc: atagar added
Component: ApplicationsCore Tor/Nyx
Owner: set to atagar

Looks like the same as #32525 and #32533.

The current advice is that if you want to use a super new python, then you should use a super new stem too (get it from git).

Damian, we had a person on #tor have this issue yesterday, and here is yet another ticket about it. I bet there will be more confused nyx users. Might be smart to reconsider whether to do a Stem stable release if there is such a concept.

comment:3 Changed 9 months ago by atagar

Hi Roger. There certainly is a sharp uptick in these reports over the last couple days which begs the question: what changed?

This bug was originally reported by teor on #30882 but I was unable to reproduce this issue with python 3.5. I'm not positive what's up, but I suspect it's something like the following...

  • This bug only occurs with new python versions (3.8?).
  • Python 2.x is discontinuing at the end of 2019.
  • A popular linux distribution (probably Debian and Ubuntu) finally made the python 3.x switch and picked the latest interpreter, causing the sharp uptick of this issue from 'obscure' to 'frequent'.

I plan to release Stem 1.8 in December, concluding our Python 2.x support and Stem's 1.x series. Hidden service v3 support is not mature enough to cut a stable release right now.

I hate to hotfix when we're so near another release but if folks would like I could provide a Stem 1.7.2 release with this one line fix. However, if I'm correct that the uptick in these reports are coming from a new linux distribution this likely won't resolve confusion (due to debian's glacial pace). That said, it would change the steps to fix this from...

% git clone
% cd stem
% sudo python --install

... to...

% sudo pip install --upgrade stem

Would folks prefer a hotfix or to wait for the Stem 1.8 release?

comment:4 Changed 9 months ago by arma

As for Debian or Ubuntu, this ticket is about Arch.

I think your question is exactly the right one: do a hotfix now, or wait some more weeks for the intended next release?

I guess it depends in part on how many more confused users we hear from -- and how many confused users we think that there are behind the scenes who just aren't reporting the breakage.

comment:5 Changed 9 months ago by cypherpunks

BTW it's defaults python on arch Linux

comment:6 Changed 9 months ago by cypherpunks

Latest stem from git working fine

comment:7 Changed 9 months ago by arma


  • Arch now ships the Python that exposes the stem bug
  • We need to get those arch users a newer stem
  • It will take a while, after the release of the newer stem, for arch to give it to them

Leads to:

  • We should do a stem release asap that has this fix, so arch can begin the process of getting it to them.

i.e. the above reasoning argues for the hotfix. looks like it might be the package that will want the update.

comment:8 Changed 9 months ago by arma

Summary: can't connect to for, whether using cookie or passwordstem says "dictionary keys changed during iteration" with new python

I closed #32566 and #32596 as a duplicate.

And giving this ticket a better title.

comment:9 Changed 8 months ago by dave_in_seattle

After a lot of failed debugging, I found this thread by googling: tor stem dictionary keys changed during iteration.

I uninstalled Python 3.8 then installed Python 3.7. The problem went away. Solved. Thank you!

I thought I should add my two cents because I'm using Windows 10.

Stem version: 1.7.1

comment:10 Changed 8 months ago by teor

Summary: stem says "dictionary keys changed during iteration" with new pythonstem says "dictionary keys changed during iteration" with python 3.8

comment:11 Changed 8 months ago by atagar

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.