thibaultcha / lua-cassandra

Pure Lua driver for Apache Cassandra
https://thibaultcha.github.io/lua-cassandra
Other
98 stars 35 forks source link

No max retry on socket timeout #105

Closed drolando closed 5 years ago

drolando commented 7 years ago

In cluster.lua:handle_error, in case of a Cassandra timeout we check whether we should retry or if we've already exceeded the maximum retries. Is there any specific reason why such a check is not implemented for socket timeouts?

In that case we only check self.retry_on_timeout, but if the socket keeps timing out we'll enter an infinite loop and the code will just hang there... https://github.com/thibaultcha/lua-cassandra/blob/master/lib/resty/cassandra/cluster.lua#L738

thibaultcha commented 6 years ago

If I remember correctly, this is the behavior that the nodejs driver implements as well: https://github.com/datastax/nodejs-driver/blob/master/lib/policies/retry.js

The reasoning behind most of this driver's implementation has always been to match the official Datastax drivers behavior as much as possible. I may have been interpreting its behavior incorrectly, and/or the nodejs driver may have changed since then.

I will shortly get back to work on this library for a 2.0.0 version which will drastically improve usability and reliability.

thibaultcha commented 5 years ago

Considering this answered.