InvalidTypeException: Invalid 32-bits integer value, expecting 4 bytes but got 8

903 views
Skip to first unread message

Igor Meltser

unread,
Mar 11, 2015, 3:40:15 AM3/11/15
to java-dri...@lists.datastax.com
Hi,

Our java app uses driver version 2.0.9 (we tried also 2.0.9.1 and 2.0.9.2) against cassandra 2.0.8. After X days of running we start getting this exception:

com.datastax.driver.core.exceptions.InvalidTypeException: Invalid 32-bits integer value, expecting 4 bytes but got 8
        at com.datastax.driver.core.TypeCodec$IntCodec.deserializeNoBoxing(TypeCodec.java:529)
        at com.datastax.driver.core.ArrayBackedRow.getInt(ArrayBackedRow.java:80)
        at com.datastax.driver.core.ArrayBackedRow.getInt(ArrayBackedRow.java:84)


from this point on driver will always throw this exception. Restart of our process fixes it.

Client app runs on CentOS 6.5 with java 1.8.0_25 64 bit
Cassandra runs on CentOS 6.5 with java 1.7.0_45 64 bit


Any idea what is going on?

Olivier Michallat

unread,
Mar 11, 2015, 4:41:06 AM3/11/15
to java-dri...@lists.datastax.com
Sounds like a corrupted response frame (or the driver not reading it correctly).

from this point on driver will always throw this exception

Could you pinpoint a particular query that this happens with, or do you see it on multiple queries? If the former, I'd be interested in more details (query string, table schema... you can contact me privately).

Restart of our process fixes it.

Restart of client only, or Cassandra as well? 

--

Olivier Michallat

Driver & tools engineer, DataStax


To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

Igor Meltser

unread,
Mar 11, 2015, 7:41:29 AM3/11/15
to java-dri...@lists.datastax.com
1. This process issues only one query:

getSession().prepare("select * from images where id = ?").setConsistencyLevel(ConsistencyLevel.LOCAL_ONE);

this is the method that executes the statements:

protected ImmutableList<ListenableFuture<ResultSet>> executeAsyncInCompletionOrder(Session session, List<Statement> statements) {
List<ResultSetFuture> futures = Lists.newArrayListWithExpectedSize(statements.size());
statements.forEach(statement -> futures.add(session.executeAsync(statement)));
return Futures.inCompletionOrder(futures);
}

This is the table:

CREATE TABLE images (
  id timeuuid,
  animal text,
  category_id int,
  country_code text,
  crawler_rank double,
  created timestamp,
  description text,
  furniture_depth text,
  furniture_height text,
  furniture_manufacturer text,
  furniture_product_number text,
  furniture_width text,
  height int,
  image_id text,
  indexed timestamp,
  indexing_error_code int,
  indexing_error_msg text,
  itis_tsn int,
  label int,
  latitude float,
  license_id int,
  locality text,
  longitude float,
  merchant text,
  mixed_breed boolean,
  offer_id text,
  owner text,
  page_url text,
  partner_id int,
  pet_age text,
 pet_gender text,
  pet_id text,
  pet_name text,
  pet_size text,
  plant_names text,
  plant_names_2 text,
  plant_names_new text,
  popular boolean,
  postal_code text,
  price float,
  price_string text,
  primary_breed text,
  primary_product boolean,
  producer_id int,
  recrawl_version int,
  region_code text,
  sale_price float,
  secondary_breed text,
  see_also text,
  shelter_name text,
  sid bigint,
  source int,
  species text,
  state int,
  status int,
  tags text,
  taken timestamp,
  text_canonicality_rank int,
  thumb_url text,
  title text,
  tsid bigint,
  uploaded timestamp,
  url text,
  views bigint,
  width int,
  PRIMARY KEY (id)
) WITH
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=864000 AND
  index_interval=128 AND
  read_repair_chance=0.100000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  default_time_to_live=0 AND
  speculative_retry='99.0PERCENTILE' AND
  memtable_flush_period_in_ms=0 AND
  compaction={'class': 'LeveledCompactionStrategy'} AND
  compression={'sstable_compression': 'LZ4Compressor'};


2. Restart to client is enough.

高健峰

unread,
May 28, 2015, 3:56:04 AM5/28/15
to java-dri...@lists.datastax.com
hi, did you solve this problem, i'm using cassandra 2.1.3 and datastax drive 2.1.3

Olivier Michallat

unread,
Jun 2, 2015, 6:08:04 AM6/2/15
to java-dri...@lists.datastax.com
This was also logged as a JIRA ticket (JAVA-691). Igor solved his problem by upgrading Cassandra to 2.0.12.

I went through the Cassandra changelog but I wasn't able to identify the specific ticket that solved this. Could you try to reproduce with Cassandra 2.1.5?

--

Olivier Michallat

Driver & tools engineer, DataStax


高健峰

unread,
Jun 3, 2015, 4:53:52 AM6/3/15
to java-dri...@lists.datastax.com
I've resolved this problem. I think It's not a bug. Here is how it occurs: one ColumnFamily was altered by one client, But in another client, I still uses a cached PrepareStatement which holds an old and wrong column-definition. so the definition and the data doesn't match. 
thank you for answering this question.
--
------
Joseph Gao
PhoneNum:15210513582
QQ: 409343351
Reply all
Reply to author
Forward
0 new messages