You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
server.info.attached_databases results in InterfaceError: 'Invalid response format' #57
Hi, first of all thank you for your work on FirebirdSQL.
I have a problem requesting information from a FirebirdSQL Server.
I am connected to a newly migrated server from FB v2.5 to 5.0.3, thus the switch fromfdb to firebird-driver.
In my previous code, I could use fdb’s server.get_attached_database_names() to get all the attached databases. Now, after updating the fbclient.dll to version 5.0.3 and switching to firebird-driver, I wanted to use the server.info.attached_databases. But this leads to the mentioned error: Invalid response format.
It does not seem to be a library configuration error, as I can request any other information (like server.info.architecture or server.info.engine_version) with the correct answer. I can also connect to any attached DB directly. That is also no problem. Just this call is not working. Am I doing something wrong? How can I debug this?
I have tried to change the encoding and charset of the server to see if it has to do something with the path names. However, there was no change.
That's certainly strange, as this information (obtained via info call with SrvInfoCode.SRV_DB_INFO code) is verified with driver test suite (see tests/test_info_providers.py function test_server_info_provider). I must admit that I run the test suite mostly only on Linux as it's my primary dev. platform, and there is no CI pipeline on github for this project to run it also on all other platforms.
Anyway, error Invalid response format is reported by InfoProvider._get_data in core.py when data block returned by server in result buffer does not end with isc_info_end tag. So, it's clearly malformed response from Windows Firebird server. What do you think @hvlad ?
The server.info.attached_databases is just wrapper that returns ServerInfoProvider.get_info(SrvInfoCode.SRV_DB_INFO)[1] which is the list of attached databases returned by get_info for this info code.
I will try to reproduce the error on Windows, as it works on Linux just fine with FB 5.0.3.
wanted to use the server.info.attached_databases. But this leads to the mentioned error: Invalid response format.
Please save this script and run it as fllowing example: python C:\FBTESTING\qa\misc\srv_connect_test.py C:\FB\60SS\fbclient.dll
(arg N1 = name of this script; arg N2 = full path to the client library of testing FB instance)
import os
import sys
import argparse as ap
import firebird.driver
from firebird.driver import driver_config, connect_server
parser = ap.ArgumentParser()
parser.add_argument("fb_clnt", help="Path to FB client library")
args = parser.parse_args()
assert os.path.isfile(args.fb_clnt), "FB client library not found: '%s'" % args.fb_clnt
# Register server
srv_cfg = """
[test_srv]
host = localhost
user = SYSDBA
password = masterkey
"""
driver_config.fb_client_library.value = args.fb_clnt
driver_config.register_server('test_srv', srv_cfg)
print('Python version:', sys.version.split()[0])
print(f'Driver package: {firebird.driver.__package__=}, {firebird.driver.__VERSION__=}')
with connect_server('test_srv', user='SYSDBA', password = 'masterkey') as srv:
print(f'{srv.info.architecture=}')
print(f'{srv.info.attached_databases=}')
print(f'{srv.info.home_directory=}')
print(f'{srv.info.version=}')
print('Done')
exit(0)
Looks like you have x64 binaries at the x86 folder, is it correct ?
Yes, that is sadly correct. As this is software installed by another company, I have no idea why this was done. I just have to make the connection work and rather not touch the FB installation otherwise.
Or is it just x86 client with x64 server ? Then it is ok.
It is the x64 server.
Could you try with x64 client ?
It is the x64 client also. The x86 client does not work as that raises a WinError in Python.
Anyway, error Invalid response format is reported by InfoProvider._get_data in core.py when data block returned by server in result buffer does not end with isc_info_end tag. So, it's clearly malformed response from Windows Firebird server. What do you think @hvlad ?
isc_info_svc_svr_db_info returns the set of response items (isc_spb_num_att, isc_spb_num_db and zero or more isc_spb_dbname) finished by isc_info_flag_end (value 127) and I don't see where it is handled in core.py (ServerInfoProvider.get_info())
Also, values of isc_spb_num_att, isc_spb_num_db is read using read_short(), while it is 4-bytes values.
Finally, engine never consider as error when all requested response bytes exactly fits the user buffer and there is no space for final isc_info_end tag.
Perhaps I missed something, as I'm not a Python developer.
So after some more digging, it seems that the call works after a fresh start of the Firebird Server for a while, but the error reappears again shortly after some reads / writes. So I don't think that this is a firebird-driver problem, but a Firebird Server one?
Is there a way in which I could output the raw response from the server?
but the error reappears again shortly after some reads / writes
What actions were performed against server during this (short) time ?
Did you change state of some database(s) to full shutdown or maybe these databases were replaced by restore ?
Activity
pcisar commentedon Sep 12, 2025
That's certainly strange, as this information (obtained via info call with
SrvInfoCode.SRV_DB_INFOcode) is verified with driver test suite (seetests/test_info_providers.pyfunctiontest_server_info_provider). I must admit that I run the test suite mostly only on Linux as it's my primary dev. platform, and there is no CI pipeline on github for this project to run it also on all other platforms.Anyway, error
Invalid response formatis reported byInfoProvider._get_dataincore.pywhen data block returned by server in result buffer does not end withisc_info_endtag. So, it's clearly malformed response from Windows Firebird server. What do you think @hvlad ?The
server.info.attached_databasesis just wrapper that returnsServerInfoProvider.get_info(SrvInfoCode.SRV_DB_INFO)[1]which is the list of attached databases returned byget_infofor this info code.I will try to reproduce the error on Windows, as it works on Linux just fine with FB 5.0.3.
pavel-zotov commentedon Sep 12, 2025
@daniel-heg
Please save this script and run it as fllowing example:
python C:\FBTESTING\qa\misc\srv_connect_test.py C:\FB\60SS\fbclient.dll(arg N1 = name of this script; arg N2 = full path to the client library of testing FB instance)
What it will show ?
PS.
On my machine output is:
If i do ISQL connection to employee than
srv.info.attached_databaseswill be non-empty list.hvlad commentedon Sep 12, 2025
@pavel-zotov script works for me with current FB5
daniel-heg commentedon Sep 12, 2025
Thanks for the swift replies.
@pavel-zotov
I get the following for my FB5 DB with the script from above:
If I remove the line with the request for the attached databases:
Apologies if you wanted me to use one of the specific testing DBs. I am not sure where to find those.
daniel-heg commentedon Sep 12, 2025
I wanted to make sure that it is not a Python version issue. I just retried with 3.11.8 and 3.12.11. The error still remains.
hvlad commentedon Sep 12, 2025
Looks like you have x64 binaries at the x86 folder, is it correct ?
hvlad commentedon Sep 12, 2025
Or is it just x86 client with x64 server ? Then it is ok.
Could you try with x64 client ?
daniel-heg commentedon Sep 12, 2025
Yes, that is sadly correct. As this is software installed by another company, I have no idea why this was done. I just have to make the connection work and rather not touch the FB installation otherwise.
It is the x64 server.
It is the x64 client also. The x86 client does not work as that raises a WinError in Python.
hvlad commentedon Sep 12, 2025
isc_info_svc_svr_db_inforeturns the set of response items (isc_spb_num_att,isc_spb_num_dband zero or moreisc_spb_dbname) finished byisc_info_flag_end(value 127) and I don't see where it is handled in core.py (ServerInfoProvider.get_info())Also, values of
isc_spb_num_att,isc_spb_num_dbis read usingread_short(), while it is 4-bytes values.Finally, engine never consider as error when all requested response bytes exactly fits the user buffer and there is no space for final
isc_info_endtag.Perhaps I missed something, as I'm not a Python developer.
daniel-heg commentedon Sep 15, 2025
So after some more digging, it seems that the call works after a fresh start of the Firebird Server for a while, but the error reappears again shortly after some reads / writes. So I don't think that this is a
firebird-driverproblem, but a Firebird Server one?Is there a way in which I could output the raw response from the server?
pavel-zotov commentedon Sep 15, 2025
What actions were performed against server during this (short) time ?
Did you change state of some database(s) to full shutdown or maybe these databases were replaced by restore ?
daniel-heg commentedon Sep 26, 2025
How can check this. Is there a possibility to trace the Server somehow?
I simply killed the
fb_inet_server.exevia the Windows Task Manager. I do not know what happens with the DBs in that case. I am sorry.I managed to print the different outputs from the Server as a byte string from python:
This is the one that results in
Invalid response format:b'2\x05\x15\x00\x00\x00\x06\x0b\x00\x00\x00j#\x00C:\\EVIDENT\\DATEN\\GLOBAL\\EHEALTH.FDBj"\x00C:\\EVIDENT\\DATEN\\GLOBAL\\GLOBAL.FDBj"\x00C:\\EVIDENT\\DATEN\\PRAXIS\\PRAXIS.FDBj"\x00C:\\EVIDENT\\DATEN\\QUELLE\\QUELLE.FDBj\x1d\x00C:\\EVIDENT\\DATEN\\TIS\\OTIS.FDBj&\x00C:\\EVIDENT\\DATEN\\TIS\\OTIS_TRANSFER.FDB\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'And this one which works, right after I kill FirebirdSQL:
b'2\x05\x05\x00\x00\x00\x06\x05\x00\x00\x00j"\x00C:\\EVIDENT\\DATEN\\GLOBAL\\GLOBAL.FDBj"\x00C:\\EVIDENT\\DATEN\\PRAXIS\\PRAXIS.FDBj\x1d\x00C:\\EVIDENT\\DATEN\\TIS\\OTIS.FDBj&\x00C:\\EVIDENT\\DATEN\\TIS\\OTIS_TRANSFER.FDBj\x1c\x00C:\\EVIDENT\\DATEN\\TIS\\TIS.FDB\x7f\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'Does this help?
hvlad commentedon Sep 26, 2025
First response tells there are 21 attachments to the 11 databases, then it list databases names and after 6th name there is
isc_info_truncatedtag.Second response tells there are 5 attachments to the 5 databases, then it list all 5 databases names, then
isc_info_flag_endandisc_info_endtags.Looks like driver doesnt handle
isc_info_truncatedtag correctly.