question

mfrenkel avatar image
mfrenkel asked steve.lacerda commented

Getting ocassional TransportException when trying to run query

Hi

We are using cassandra datastax driver as part of our solution and we have an issue where we get a TransportException occasionally when we try to run INSERT INTO query. This happens when we have 2 nodes running cassandra each, with one node it stops happening.

Our code basically runs these INSERT queries periodically on both nodes, and for some reason occasionally (and randomly) the execute() function of the datastax driver throws a TransportException.

Because it only happens with 2 nodes, we think it might have something to do with the simultaneous running and/or synchronization of the nodes, but we are not entirely sure.

We looked at the cassandra logs and ruled out memory/GC issues.

Do you have any idea/suggestion why this might be happening?

Thanks

--- info ---

Cassandra version: 4.0.1

Datastax driver version: 3.11.0

Error:

Connection has been closed
        at com.datastax.driver.core.exceptions.TransportException.copy(TransportException.java:38)
        at com.datastax.driver.core.exceptions.TransportException.copy(TransportException.java:24)
        at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:35)
        at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:293)
        at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:58)
java driver
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

steve.lacerda avatar image
steve.lacerda answered steve.lacerda commented

Hi, I would look at updating the driver to 4.x first off because you may see some protocol issues on the 3.x driver with 4.x cassandra. Also, you can look at things like your TCP values:

https://docs.datastax.com/en/dse/5.1/dse-dev/datastax_enterprise/config/configRecommendedSettings.html#configSetKernelParameters


2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

mfrenkel avatar image mfrenkel commented ·
Hi

The problem is that driver 4.x has API changes that our code will not work with, that's why we need to stay with 3.x.

I tried upgrading from 3.11.0 to 3.11.1 but now I'm getting a CASWriteUnknownException and I can't find anything about it online.

Regarding the TCP settings, I tried that and it doesn't fix it.

Can you please assist with understanding what causes this issue and/or what other ways there are to debug it?


Thanks

0 Likes 0 ·
mfrenkel avatar image mfrenkel commented ·

OK it seems that when set the idempotence flag of the query to true the issue doesn't occur anymore, I'm assuming because of the retries.

Am I safe to assume that a "INSERT INTO ... IF NOT EXISTS" is idempotent? Is there a risk in setting idempotent=true for this query?

0 Likes 0 ·
Erick Ramirez avatar image
Erick Ramirez answered

There isn't enough information in what you provided for us to be able to figure out what's happening.

Please update your original question with the following:

  • full error message + full stack trace
  • table schema
  • full CQL query
  • minimal code which replicates the issue

In response to your follow up question, it's not likely that it has anything to do with idempotence. And CAS/LWTs are always idempotent because the write will only ever get applied if the condition is true. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.