Opened 2 years ago

Closed 2 years ago

#16054 closed defect (fixed)

Cannot unpickle with Stem 1.4.0

Reported by: tom Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I was working on getting the info for #16048 and ran into a problem :)

To test depictor without doing a ton of network i/o I uncomment lines [0], run ./write_website.py once to download and save the files, and then run ./website.py which will read the pickled files[1].

[0] https://gitweb.torproject.org/depictor.git/tree/write_website.py#n61
[1] https://gitweb.torproject.org/depictor.git/tree/website.py#n964

This now fails. FWIW I downloaded the files and constructed the objects using validate = True in the downloader [2]

[2] https://gitweb.torproject.org/depictor.git/tree/write_website.py#n35

Traceback (most recent call last):
  File "./website.py", line 980, in <module>
    c = pickle.load(open('consensus.p', 'rb'))
  File "/usr/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 1215, in load_build
    setstate = getattr(inst, "__setstate__", None)
  File "/tor/depictor/stem/descriptor/__init__.py", line 599, in __getattr__
    if self._lazy_loading and name in self.ATTRIBUTES:
  File "/tor/depictor/stem/descriptor/__init__.py", line 599, in __getattr__
    if self._lazy_loading and name in self.ATTRIBUTES:
  File "/tor/depictor/stem/descriptor/__init__.py", line 599, in __getattr__
    if self._lazy_loading and name in self.ATTRIBUTES:
  File "/tor/depictor/stem/descriptor/__init__.py", line 599, in __getattr__
    if self._lazy_loading and name in self.ATTRIBUTES:

Child Tickets

Change History (5)

comment:1 Changed 2 years ago by atagar

Interesting. Seems one of those two attributes are somehow undefined in the unpickled object. self._lazy_loading comes from our init method and ATTRIBUTES is a class constant.

Just to make sure, you're not trying to unpickle things that were created before upgrading to Stem 1.4.0 - right? If not then not really sure what's up. :/

comment:2 Changed 2 years ago by tom

That's correct, this was a fresh clone of everything and the first thing I did was checkout stem's 1.4.0 tag.

comment:3 Changed 2 years ago by atagar

Hmmmm. I added pickleability unit tests for exit policies when we had a similar problem with an earlier release (the cause there was @lru_caching, which isn't the case here). Maybe making a similar test for this will repro it.

comment:4 Changed 2 years ago by atagar

Fixed and added a test for pickleability. Presently tor's git repos are unavailable so gonna need to wait for that to be sorted out before pushing and making a hotfix release.

comment:5 Changed 2 years ago by atagar

Resolution: fixed
Status: newclosed

Fixed, and made a 1.4.1 hotfix release. Thanks for the catches!

Note: See TracTickets for help on using tickets.