Fix multi-version API infinite recursion when creating database #2169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When creating a database with API version <610 and client libraries 6.1 or newer, the
fdb_cluster_create_database
function was implemented by callingfdb_create_database
. When using the multi-version API with a program that was explicitly linked againstfdb_c
, this could result in an infinite recursion where an external library callsfdb_create_database
on the primary library, who then calls back into the external, etc.This is known to affect programs written using the Go and Flow bindings as well as some written using the C bindings.
The solution implemented here removes
DLLEXPORT
from a variety of functions that don't need to be public and avoids callingfdb_create_database
by adding a private implementation function.I've opened this PR against release-6.1, as it is necessary to backport this if we want to use 6.1 as an external client version. I'll update release notes on relevant branches once we've decided how we intend to release this.
This doesn't really address the issue of preventing this in the future (outside of a couple comments), and which ideas or other potential solutions to the problem are considered I'm leaving this as a draft PR.