Skip to content

Check if session is closed to handle errors properly #846

@nikagra

Description

@nikagra

Background

This is a minor improvement to enhance error handling so that clients do not receive misleading errors, following up on customer report inc-zd62350-solitics (CUSTOMER-245).

Summary

Ensure the driver checks if CqlSession is closed before handling errors (e.g. NoNodeAvailableException) during shutdown, to avoid misleading error handling and noisy logs.

Problem

When an application shuts down and closes the CqlSession, in-flight requests may throw NoNodeAvailableException. The driver does not currently check whether the session is already closed before surfacing these errors, leading to misleading error logs during an otherwise clean shutdown.

Stack Trace

com.datastax.oss.driver.api.core.NoNodeAvailableException: No node was available to execute the query
    at com.datastax.oss.driver.api.core.NoNodeAvailableException.copy(NoNodeAvailableException.java:42) ~[java-driver-core-4.19.0.6.jar!/:?]

17:25:24.441 [pool-39-thread-14] ERROR com.beezer.service.oapi.services.UniqueKeyValueService - Can not read from scylla DB: No node was available to execute the query

Expected Behavior

When the session is being closed or is already closed, errors like NoNodeAvailableException should either be suppressed or clearly attributed to shutdown rather than surfaced as real errors.

Driver

  • Driver: java-driver
  • Branch: 4.x

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