Skip to content

Session Timeout and Context Timeout #953

Open
@robusto

Description

@robusto

Looking at the "exec()" method of "Conn" in "conn.go", it seems like there's two ways we can hit a timeout condition when a Context with a deadline is provided to the Query.

As I understand it, the "Session" ClusterConfig.Timeout value is propagated to Conn which is used in the "timeoutCh" and and the Query's context is used for "ctxDone". Coming from the Datastax drivers, this is unexpected behavior.

For example, from the Python driver docs on session.default_timeout

default_timeout = 10.0
A default timeout, measured in seconds, for queries executed through execute() or execute_async(). This default may be overridden with the timeout parameter for either of those methods.

Source: https://datastax.github.io/python-driver/api/cassandra/cluster.html#cassandra.cluster.Session

We don't have to copy the same behavior, but expectations are a bit unclear. I think one of the following can be done:

  • better documentation/best practices around ClusterConfig.Timeout and/or Query().WithContext and timeouts. E.g. Session timeout should be 0 or very large when using Contexts to manage timeout limits.
  • When Context is provided, ignore the Conn.timeout and/or call a separate 'Conn' method that only respects the context timeout, errors, and quits of the connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions