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

Reading while at end of stream error #27

Open
aslubsky opened this issue Sep 26, 2014 · 7 comments
Open

Reading while at end of stream error #27

aslubsky opened this issue Sep 26, 2014 · 7 comments
Assignees

Comments

@aslubsky
Copy link

Hi

CREATE TABLE users_log (
  session_token ascii,
  user_id int,
  site_id int,
  role_id int,
  user_name varchar,
  date_start timestamp,
  date_stop timestamp,
  ip varchar,
  agent text,
  tags list<text>,
  PRIMARY KEY (session_token)
);

SELECT * FROM "users_log" WHERE "site_id" = 3 ALLOW FILTERING ;

in cqlsh - OK
by php-cassandra-binary - "Reading while at end of stream"

file "/vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/Rows.php"
line 65
trace:

#0 vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/DataStream.php(59): evseevnn\Cassandra\Protocol\Response\DataStream->read(2)
#1 vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/DataStream.php(142): evseevnn\Cassandra\Protocol\Response\DataStream->readShort()
#2 vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/DataStream.php(261): evseevnn\Cassandra\Protocol\Response\DataStream->readList(Array)
#3 vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/Rows.php(63): evseevnn\Cassandra\Protocol\Response\DataStream->readByType(Array)
#4 vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/Rows.php(132): evseevnn\Cassandra\Protocol\Response\Rows->current()
#5 vendor/evseevnn/php-cassandra-binary/src/Database.php(182): evseevnn\Cassandra\Protocol\Response\Rows->asArray()
#6 src/Base/Cassandra/Collection.php(98): evseevnn\Cassandra\Database->query('SELECT * FROM "...', Array)

Thanks

@ghost
Copy link

ghost commented Sep 29, 2014

It's happening to me as well. Please help. Thanks.

It happens when you have a column like this:
tags list,

But you never set a value to such column (of list type)

@penfold45
Copy link

Hi I am getting this too.

I have columns that do not always have data and in these circumstances I get this error.

Would love to see a fix for this soon ish otherwise not sure I can release this into production as it casuses no end of notice errors for me.

Thanks

@aslubsky
Copy link
Author

I fixed it in my fork https://github.com/aslubsky/php-cassandra-binary
Fix is not very good (dirty try cath) but work and may be used as temporary solution

@evseevnn-zz
Copy link
Owner

ok, I'll try to fix it tomorrow during the day

@penfold45
Copy link

Hi did get around to looking at this?

@steambao
Copy link

Can confirm this occurs when reading NULL'ed MAP<><> column types as:
readShort() is trying to get a count from an empty $this->data string (len = 0).

Like aslubsky, did a temp fix in my fork 344ae09

@teanooki
Copy link

teanooki commented Dec 3, 2014

There is a general problem with NULL values. I used the development branch and added all the ($isCollectionElement = false) parameters in DataStream.php from the master branch. That fixed the Problem with the maps. The most important change was adding this:

    public function readByType(array $type, $isCollectionElement = false) {
        if (strlen($this->data) <= 0){
            return null;
        }

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

No branches or pull requests

5 participants