Sporadic error 1039 when scanning a range

Sometimes, when my app is restarted, I get repeated error 1039 (protocol version of the cluster has changed), even though nothing changed on the cluster.

The issue only goes away when restarting the app.

The app is launched with the following environment variables set:

FDB_NETWORK_OPTION_EXTERNAL_CLIENT_LIBRARY=/usr/x86_64-pc-linux-gnu/lib/libfdb_c.so
FDB_NETWORK_OPTION_CLIENT_THREADS_PER_VERSION=8

The stack trace is:

java.util.concurrent.CompletionException: com.apple.foundationdb.FDBException: The protocol version of the cluster has changed
at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375)
at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1947)
at com.apple.foundationdb.RangeQuery$AsyncRangeIterator.hasNext(RangeQuery.java:263)

Caused by: com.apple.foundationdb.FDBException: The protocol version of the cluster has changed
at com.apple.foundationdb.NativeFuture.Future_getError(Native Method)
at com.apple.foundationdb.FutureResults.getIfDone_internal(FutureResults.java:47)
at com.apple.foundationdb.FutureResults.getIfDone_internal(FutureResults.java:28)
at com.apple.foundationdb.NativeFuture.marshalWhenDone(NativeFuture.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

Is there anything that I may be doing wrong which is causing this error to appear?

Found the solution, the cluster_version_changed is a retry-able error which can occur when using the multi-version client, so re-running the transaction solves the issue.

It is explained here: Using FoundationDB Clients — FoundationDB 7.2 (search for cluster_version_changed).

Sorry for the noise.

2 Likes