Cassandra timeout during read query?

Pretty much every time I “save” my code in the development environment, this pops up in a pink box at the top.

“com.datastax.driver.core.exceptions.ReadTimeoutException: Cassandra timeout during read query at consistency TWO (2 responses were required but only 1 replica responded)”

I saw this for the first time when when working on @cino 's IDE. He is on the US East Shard. I’ve never seen this message on the EU shard

when i saw thought it looked like server was slow or not responding. but i was only guessing and I think that was the only time i saw it happen.

I forgot to mention i have some timeout issues and I have to click on my hub log back in then go back to my device handler tab.

above my skill set but has a lot of info on it

This stems from the latent DB issues we are having. Basically that means that we went to read the data and we wanted to have two nodes respond back and only one did. We are working hard on this, it’s THE number one priority.

Thanks for your response!

This is an old thread, but I just became a new victim of the “Cassandra timeout” this week.

My “JJ’s Test2” smartapp WHICH HAD BEEN RUNNING FINE FOR 2 YEARS, failed to execute on thursday (it runs every 5 days to dump my temperature snapshots history).
I tried to run it in the simulator, and got either of those 2 errors, at each unsuccessful try :

“java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.datastax.driver.core.exceptions.ReadTimeoutException: Cassandra timeout during read query at consistency LOCAL_ONE (1 responses were required but only 0 replica responded) @ line 112"
"java.lang.reflect.UndeclaredThrowableException @ line 112”

Considering that line 112 is the line where the “JJ’s Test2” smartapp extracts the list of events to send (see below), it looks clearly like the SmartThings cloud servers are overloaded (again) or like somebody changed a timeout value for a much lower one.
This is corroborated by the fact that the SAME smartapp works fine in the simulator for only 1 or 2 temperature sensors, but fails beyond (I have 11).

--------------------- abstract from “JJ’s Test2” smartapp ---------------------
111 for (tempSens in temperatureSensors) {
112 def allEvents = tempSens.eventsBetween(startDate, endDate, [max:2000]).findAll{ == “temperature”}

I notified support of the problem, but as soon as they saw “custom Smartapp”, they considered it was not their responsibility.
This looks highly disingenuous to me, since this Smartapp has been perfectly working for 2 years, and only a change or overload in the SmartThings cloud servers could explain its present faulty behavior.

According to Tim Slagle, “this is THE number one priority” since April…
…but in April I never had the problem, but I do have it NOW ! :sob:.

=> I have 2 questions :

  1. could I somehow rewrite lines 111-112 to work around this problem ?
  2. who is in charge, and who should be notified, in case of cloud overload ?

This smartapp is +++ESPECIALLY CRITICAL FOR ME+++ since it is the one which I rely upon to download all my temperature measurements every 5 days (SmartThings cancels all events history beyond 7 days).
I have 11 Temperature Sensors at “Le Puits Jamet” location, each producing about 8 snapshots per day, so I download about 450 events every 5 days.
Dumping history for 1 sensor instead of 11 would multiply the integration work I do manually in Excel by 11, soon becoming a nightmare.

Thanks for your help

I don’t know who’s in charge, but a number of people are reporting timeouts even with official features. See the following post from a staff member who is working on the problem:

1 Like

I know it is against the rules, but I duplicate part of this post into this Developers forum, considering my coding question may be more appropriate there.

For the third consecutive week, my periodic history download SmartApp failed to execute.
The only difference is that this time, running it by hand from the IDE, I got an “error” notification in the log :

java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 122413839485071 @ line 112

which resulted in the usual IDE return code :

java.lang.reflect.UndeclaredThrowableException @ line 112

I wonder if somehow, the way I wrote my lines 111-112 in my “JJ’s Test2” SmartApp does not result in parallel threads competiting for the same DB access, and when not getting through, then going into time-out.

111    for (tempSens in temperatureSensors) {
112        def allEvents = tempSens.eventsBetween(startDate, endDate, [max:2000]).findAll{ == "temperature"}

But if it is the case, how can I modify my code to force serial execution and avoid this concurrent.TimeoutException ?
Sorry if it is a dumb question, but Java/Groovy is not my forte… :frowning: