Skip to content

ShardingInfo does not implement Serializable, breaks ScalaTest forked reporters #805

@dkropachev

Description

@dkropachev

Description

com.datastax.oss.driver.internal.core.protocol.ShardingInfo does not implement Serializable. This causes NotSerializableException when exceptions containing driver node metadata are serialized across process boundaries.

Reproduction

When a AllNodesFailedException is thrown (e.g. node goes down), the exception chain includes references to node metadata which contains ShardingInfo. If this exception needs to be serialized — for example, by ScalaTest's DispatchReporter sending a SuiteAborted event from a forked test JVM back to the main process — serialization fails:

java.io.NotSerializableException: com.datastax.oss.driver.internal.core.protocol.ShardingInfo
	at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1187)
	at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1572)
	...

Impact

This is observed in the spark-scylladb-connector CI where all integration tests pass but the job exits with code 2 because the test reporter fails to serialize the exception.

Suggested Fix

Make ShardingInfo implement Serializable, or mark the field referencing it as transient in the node metadata / exception chain so it doesn't break serialization of AllNodesFailedException.

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