Webber Chen
Webber Chen

Reputation: 21

Cassandra Python driver 3.0.0 "IndexError: Buffer slice out of bounds" exception

Currently we are using Cassandra Python driver 3.0.0 on ubuntu 14.04, and we have been running into the exception of "IndexError: Buffer slice out of bounds" when the retrieved row contains a large map.

    >>> query = 'SELECT "user_id", "data" FROM users WHERE user_id IN (bb47d269-73a6-475a-9283-0002e2a0872a, 81258ffd-fbb0-47e6-8a5e-0003208880ba)'
    >>> future = store.session.execute_async(query)
    >>> future.result() <- exception generated here
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "cassandra/cluster.py", line 3122, in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:59993)
    IndexError: Buffer slice out of bounds

The data is map and contains about 3000 entries.

Upvotes: 1

Views: 208

Answers (1)

Greg Bestland
Greg Bestland

Reputation: 843

This looks very similar to a issue opened already, located here.

https://datastax-oss.atlassian.net/browse/PYTHON-459

The fix is not yet in a major release, but it should be in 3.1. In the meantime you can work around this issue by installing the driver with the --no-cython flag. You may see a small hit performance but it should get around your problem.

If you are installing with pip the surefire way to disable cython on install would be to run.

"CASS_DRIVER_NO_CYTHON=1 pip install casandra-driver"

Make sure to uninstall before re-installing.

Upvotes: 2

Related Questions