question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Distributed 2021.3.1 `distributed.protocol.serialize.pickle_loads` fails with `IndexError: tuple index out of range`

See original GitHub issue

What happened:

The following exception occred with the latest version of distributed, in a test that has previously passed:

header = {'compression': (None, None), 'num-sub-frames': 2, 'serializer': 'pickle', 'split-num-sub-frames': (1, 1), ...}
frames = [<memory at 0x1209deae0>, <memory at 0x1209dea10>]
    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:
E           IndexError: tuple index out of range

“writeable” is an empty tuple in the above header.

What you expected to happen:

After digging a bit and comparing runs of the same test between 2021.3.0 and 2021.3.1, I found the following:

In version 2021.3.0 the input frames always has one element, hence buffers is always an empty list --> so the for loop, which contains writeable[i] never runs; writable is always an empty tuple

In version 2021.3.1 the third time it gets to this function, frames has 2 elements, hence buffers is not empty, and the for loop is executed; writable is still an empty tuple, hence code fails.

I saw that there were substantial changes to distributed.protocol.core.loads, where frames is passed down in its “truncated” from (sub_frames) to the function which eventually breaks. I don’t know if this is a bug introduced, or our code needs changing. I’m not familiar with the underlying mechanisms, so I’d appreciate if someone could take a look.

Environment:

  • Dask version: 2021.3.1
  • Python version: 3.7.10
  • Operating System: MacOS Mojave (but also fails on linux-based gitlab runners)
  • Install method (conda, pip, source): pip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:43 (27 by maintainers)

github_iconTop GitHub Comments

2reactions
mrocklincommented, Apr 2, 2021

Thank you everyone who participated in helping to track this down. I appreciate it.

2reactions
jrbourbeaucommented, Mar 31, 2021

Thanks @alejandrofiel, however since others can’t access the CSV files you’re using, this makes it difficult for us to debug. See https://blog.dask.org/2018/02/28/minimal-bug-reports for some information on crafting minimal bug reports

Read more comments on GitHub >

github_iconTop Results From Across the Web

python pickle IndexError: tuple index out of range
Hi I'm working on a python text adventure and I got a save feature working that saved all main variables inventory, location and...
Read more >
Changelog — Python 3.11.1 documentation
To fix the race condition, the thread which requested the GIL drop now resets its request before exiting. Issue discovered and analyzed by ......
Read more >
Python IndexError: tuple index out of range Solution
When you try to access an item in a tuple that does not exist, Python returns an error that says “tuple index out...
Read more >
Python IndexError: List Index Out of Range [Easy Fix] - Finxter
One frequent bug in Python is the IndexError: list index out of range . So, what does this error message mean?
Read more >
I keep getting “IndexError: list index out of range” when trying ...
This is most likely a problem on your side regarding logic inside the code. That error occurs when you try to access an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found