Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pickle_loads attempts item assignment with tuple #4611

Closed
JSKenyon opened this issue Mar 19, 2021 · 5 comments
Closed

pickle_loads attempts item assignment with tuple #4611

JSKenyon opened this issue Mar 19, 2021 · 5 comments

Comments

@JSKenyon
Copy link

What happened:
I am using the main branch in order to play with annotation functionality as well as to circumvent other serialization problems. However, the changes made in #4541 seem to have broken my application. In particular,

def pickle_loads(header, frames):
x, buffers = frames[0], frames[1:]
writeable = header["writeable"]
for i in range(len(buffers)):
mv = memoryview(buffers[i])
if writeable[i] == mv.readonly:
if mv.readonly:
buf = memoryview(bytearray(mv))
else:
buf = memoryview(bytes(mv))
if buf.nbytes > 0:
buffers[i] = buf.cast(mv.format, mv.shape)
else:
buffers[i] = buf.cast(mv.format)
return pickle.loads(x, buffers=buffers)
triggers messages like:

File "/site-packages/distributed/protocol/serialize.py", line 78, in pickle_loads
    buffers[i] = memoryview(bytearray(mv)).cast(mv.format, mv.shape)
TypeError: 'tuple' object does not support item assignment

@madsbk could you please help me understand the specific condition that would trigger this failure?

What you expected to happen:
I expected no change - the 2021.02.0 versions don't seem to have the problem.

Minimal Complete Verifiable Example:

I don't have a specific example, rather I am fairly certain that buffers is of type tuple and item assignment will never be successful.

Environment:

  • Dask version: main as of 19 March 2021
  • Python version: 3.8.8
  • Operating System: Pop!_OS 18.04
  • Install method (conda, pip, source): pip
@quasiben
Copy link
Member

I think this has been resolved in #4595 . Can you try latest in main ?

@JSKenyon
Copy link
Author

JSKenyon commented Mar 19, 2021 via email

@quasiben
Copy link
Member

quasiben commented Mar 19, 2021

@JSKenyon the error reported looks like an older version of serialize compared to latest in main. Can you double check that latest is installed correctly ?

python -c 'import distributed;print(distributed.version)'

I have 2021.03.0+18.g98148cbf

@JSKenyon
Copy link
Author

I just reinstalled to be extra sure and the problem has indeed gone away. Maybe I made a mistake when setting up my environment earlier (that or I somehow ended up one version behind main). Reagardless, thanks for the help @quasiben!

@quasiben
Copy link
Member

quasiben commented Mar 19, 2021

Thanks for reporting and confirming the issue was resolved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants