I tried to debug go program which uses go bindings to access FDB in delve (go debugger) and got the following error: FoundationDB error code 4100 (An internal error occurred)
The 4100 error is returned by fdb_setup_network() C function.
The same program runs without errors and successfully connects to FDB when launched without debugger.
I use fdb client 6.2.25 for windows, go 1.15.2 (buth the same was for 1.13).
What may be the reason for such error and how to avoid it?
Unfortunately, a failure in fdb_setup_network is probably early enough that you can’t get trace files, unless perhaps you are calling this function more than once.
I believe it is the case that internal errors should print out some extra details about the error to stderr. In particular, it should have a file and line number of the error as well as a backtrace. Do you get any of this output?
Interesting. Are you loading any external client versions? Doing so would require setting the EXTERNAL_CLIENT_DIRECTORY or EXTERNAL_CLIENT_LIBRARY network options.
Assuming not, we could potentially try to read the string being returned by your library from the getClientVersion call. We can call this directly using a function in the C API: fdb_get_client_version, which will return a const char* with the string we want. If you were willing to modify your Go bindings, you could probably add a line something like this:
@ajbeamon, I do not use multiversion client and there is only one fdb installation on my computer.
The string returned by C.fdb_get_client_version() is the same when I launch the application with or without debugger (delve): 6.2.25,Current version id not currently supported within Windows.,fdb00b062010001
I don’t immediately spot anything wrong with that string. I wonder if this is related to https://github.com/apple/foundationdb/issues/3424, which identified an issue that affects ClientVersionRef. This has been fixed on master but not on any prior release, so there’s probably not a great way to confirm this outside of building a patch.
I’ve backported the PR addressing the issue I mentioned, which you can see here: https://github.com/apple/foundationdb/pull/3849. It should go into our next release, and hopefully it will resolve your issue.