2 @message |
Server crashed ?
firebird.driver.types.DatabaseError: Error reading data from the connection.
LOG DETAILS:
2025-05-20 07:01:00.381
2025-05-20 07:01:00.390 act = <firebird.qa.plugin.Action object at [hex]>
2025-05-20 07:01:00.398 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2025-05-20 07:01:00.409
2025-05-20 07:01:00.424 @pytest.mark.version('>=5.0.3')
2025-05-20 07:01:00.432 def test_1(act: Action, capsys):
2025-05-20 07:01:00.439
2025-05-20 07:01:00.445 if act.get_server_architecture() != 'SuperServer':
2025-05-20 07:01:00.457 pytest.skip('Applies only to SuperServer')
2025-05-20 07:01:00.472
2025-05-20 07:01:00.485 # Scan line-by-line through databases.conf, find line starting with REQUIRED_ALIAS and extract name of file that
2025-05-20 07:01:00.499 # must be created in the $(dir_sampleDb)/qa/ folder. This name will be used further as target database (tmp_fdb).
2025-05-20 07:01:00.514 # NOTE: we have to SKIP lines which are commented out, i.e. if they starts with '#':
2025-05-20 07:01:00.529 p_required_alias_ptn = re.compile( '^(?!#)((^|\\s+)' + REQUIRED_ALIAS + ')\\s*=\\s*\\$\\(dir_sampleDb\\)/qa/', re.IGNORECASE )
2025-05-20 07:01:00.545 fname_in_dbconf = None
2025-05-20 07:01:00.561
2025-05-20 07:01:00.577 with open(act.home_dir/'databases.conf', 'r') as f:
2025-05-20 07:01:00.591 for line in f:
2025-05-20 07:01:00.604 if p_required_alias_ptn.search(line):
2025-05-20 07:01:00.615 # If databases.conf contains line like this:
2025-05-20 07:01:00.632 # tmp_8194_alias = $(dir_sampleDb)/qa/tmp_qa_8194.fdb
2025-05-20 07:01:00.646 # - then we extract filename: 'tmp_qa_8194.fdb' (see below):
2025-05-20 07:01:00.654 fname_in_dbconf = Path(line.split('=')[1].strip()).name
2025-05-20 07:01:00.661 break
2025-05-20 07:01:00.667
2025-05-20 07:01:00.674 # if 'fname_in_dbconf' remains undefined here then propably REQUIRED_ALIAS not equals to specified in the databases.conf!
2025-05-20 07:01:00.680 #
2025-05-20 07:01:00.686 assert fname_in_dbconf
2025-05-20 07:01:00.692
2025-05-20 07:01:00.698 srv_cfg = """
2025-05-20 07:01:00.707 [local]
2025-05-20 07:01:00.715 host = localhost
2025-05-20 07:01:00.724 user = SYSDBA
2025-05-20 07:01:00.733 password = masterkey
2025-05-20 07:01:00.742 """
2025-05-20 07:01:00.758 srv_cfg = driver_config.register_server(name = 'test_srv_gh_8194', config = '')
2025-05-20 07:01:00.769
2025-05-20 07:01:00.779 db_cfg_name = 'tmp_8194'
2025-05-20 07:01:00.787 db_cfg_object = driver_config.register_database(name = db_cfg_name)
2025-05-20 07:01:00.796 db_cfg_object.server.value = srv_cfg.name
2025-05-20 07:01:00.804 db_cfg_object.protocol.value = NetProtocol.INET
2025-05-20 07:01:00.815 db_cfg_object.database.value = REQUIRED_ALIAS
2025-05-20 07:01:00.826 for i in range(LOOP_LIMIT):
2025-05-20 07:01:00.837 # ::: NB :::
2025-05-20 07:01:00.852 # charset must be 'utf8' otherwise problem can not be reproduced!
2025-05-20 07:01:00.863 # (see also note by the author of ticket in his starting message)
2025-05-20 07:01:00.873 > with create_database(db_cfg_name, user = act.db.user, password = act.db.password, charset = 'utf8') as con:
2025-05-20 07:01:00.880
2025-05-20 07:01:00.890 tests/bugs/gh_8194_test.py:89:
2025-05-20 07:01:00.904 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-05-20 07:01:00.914
2025-05-20 07:01:00.927 database = 'tmp_8194'
2025-05-20 07:01:00.936
2025-05-20 07:01:00.944 def create_database(database: str, *, user: str=None, password: str=None, role: str=None,
2025-05-20 07:01:00.952 no_gc: bool=None, no_db_triggers: bool=None, dbkey_scope: DBKeyScope=None,
2025-05-20 07:01:00.958 crypt_callback: iCryptKeyCallbackImpl=None, charset: str=None,
2025-05-20 07:01:00.969 overwrite: bool=False, auth_plugin_list=None,
2025-05-20 07:01:00.978 session_time_zone: str=None) -> Connection:
2025-05-20 07:01:00.987 """Creates new database.
2025-05-20 07:01:01.003
2025-05-20 07:01:01.017 Arguments:
2025-05-20 07:01:01.032 database: DSN or Database configuration name.
2025-05-20 07:01:01.045 user: User name.
2025-05-20 07:01:01.058 password: User password.
2025-05-20 07:01:01.067 role: User role.
2025-05-20 07:01:01.079 no_gc: Do not perform garbage collection for this connection.
2025-05-20 07:01:01.089 no_db_triggers: Do not execute database triggers for this connection.
2025-05-20 07:01:01.097 dbkey_scope: DBKEY scope override for connection.
2025-05-20 07:01:01.103 crypt_callback: Callback that provides encryption key for the database.
2025-05-20 07:01:01.109 charset: Character set for connection.
2025-05-20 07:01:01.115 overwrite: Overwite the existing database.
2025-05-20 07:01:01.122 auth_plugin_list: List of authentication plugins override
2025-05-20 07:01:01.130 session_time_zone: Session time zone [Firebird 4]
2025-05-20 07:01:01.137
2025-05-20 07:01:01.142 Hooks:
2025-05-20 07:01:01.148 Event `.ConnectionHook.ATTACHED`: Executed before `Connection` instance is
2025-05-20 07:01:01.154 returned. Hook must have signature::
2025-05-20 07:01:01.159
2025-05-20 07:01:01.165 hook_func(connection: Connection) -> None
2025-05-20 07:01:01.171
2025-05-20 07:01:01.179 Any value returned by hook is ignored.
2025-05-20 07:01:01.186 """
2025-05-20 07:01:01.192 db_config = driver_config.get_database(database)
2025-05-20 07:01:01.197 if db_config is None:
2025-05-20 07:01:01.203 db_config = driver_config.db_defaults
2025-05-20 07:01:01.208 db_config.database.value = database
2025-05-20 07:01:01.214 if db_config.server.value is None:
2025-05-20 07:01:01.219 srv_config = driver_config.server_defaults
2025-05-20 07:01:01.225 else:
2025-05-20 07:01:01.230 srv_config = driver_config.get_server(db_config.server.value)
2025-05-20 07:01:01.236 if srv_config is None:
2025-05-20 07:01:01.241 raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
2025-05-20 07:01:01.249 else:
2025-05-20 07:01:01.256 if db_config.server.value is None:
2025-05-20 07:01:01.264 srv_config = driver_config.server_defaults
2025-05-20 07:01:01.271 else:
2025-05-20 07:01:01.287 srv_config = driver_config.get_server(db_config.server.value)
2025-05-20 07:01:01.301 if srv_config is None:
2025-05-20 07:01:01.315 raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
2025-05-20 07:01:01.325 if user is None:
2025-05-20 07:01:01.336 user = db_config.user.value
2025-05-20 07:01:01.346 if user is None:
2025-05-20 07:01:01.354 user = srv_config.user.value
2025-05-20 07:01:01.366 if password is None:
2025-05-20 07:01:01.379 password = db_config.password.value
2025-05-20 07:01:01.387 if password is None:
2025-05-20 07:01:01.394 password = srv_config.password.value
2025-05-20 07:01:01.401 if role is None:
2025-05-20 07:01:01.409 role = db_config.role.value
2025-05-20 07:01:01.417 if charset is None:
2025-05-20 07:01:01.425 charset = db_config.charset.value
2025-05-20 07:01:01.432 if charset:
2025-05-20 07:01:01.439 charset = charset.upper()
2025-05-20 07:01:01.446 if auth_plugin_list is None:
2025-05-20 07:01:01.455 auth_plugin_list = db_config.auth_plugin_list.value
2025-05-20 07:01:01.464 if session_time_zone is None:
2025-05-20 07:01:01.472 session_time_zone = db_config.session_time_zone.value
2025-05-20 07:01:01.481 dsn = _connect_helper(db_config.dsn.value, srv_config.host.value, srv_config.port.value,
2025-05-20 07:01:01.488 db_config.database.value, db_config.protocol.value)
2025-05-20 07:01:01.497 dpb = DPB(user=user, password=password, role=role, trusted_auth=db_config.trusted_auth.value,
2025-05-20 07:01:01.511 sql_dialect=db_config.db_sql_dialect.value, timeout=db_config.timeout.value,
2025-05-20 07:01:01.522 charset=charset, cache_size=db_config.cache_size.value,
2025-05-20 07:01:01.534 no_linger=db_config.no_linger.value, utf8filename=db_config.utf8filename.value,
2025-05-20 07:01:01.542 no_gc=no_gc, no_db_triggers=no_db_triggers, dbkey_scope=dbkey_scope,
2025-05-20 07:01:01.549 dummy_packet_interval=db_config.dummy_packet_interval.value,
2025-05-20 07:01:01.556 config=db_config.config.value, auth_plugin_list=auth_plugin_list,
2025-05-20 07:01:01.565 session_time_zone=session_time_zone, set_bind=db_config.set_bind.value,
2025-05-20 07:01:01.573 decfloat_round=db_config.decfloat_round.value,
2025-05-20 07:01:01.580 decfloat_traps=db_config.decfloat_traps.value,
2025-05-20 07:01:01.587 overwrite=overwrite, db_cache_size=db_config.db_cache_size.value,
2025-05-20 07:01:01.597 forced_writes=db_config.forced_writes.value, page_size=db_config.page_size.value,
2025-05-20 07:01:01.607 reserve_space=db_config.reserve_space.value, sweep_interval=db_config.sweep_interval.value,
2025-05-20 07:01:01.616 db_sql_dialect=db_config.db_sql_dialect.value, db_charset=db_config.db_charset.value)
2025-05-20 07:01:01.626 > return __make_connection(True, dsn, db_config.utf8filename.value,
2025-05-20 07:01:01.636 dpb.get_buffer(for_create=True), db_config.sql_dialect.value,
2025-05-20 07:01:01.645 charset, crypt_callback)
2025-05-20 07:01:01.652
2025-05-20 07:01:01.659 ../lib/python3.11/site-packages/firebird/driver/core.py:2242:
2025-05-20 07:01:01.667 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-05-20 07:01:01.675
2025-05-20 07:01:01.685 create = True, dsn = 'inet://tmp_gh_8194_alias', utf8filename = None
2025-05-20 07:01:01.693 dpb = b'\x01\x1c\x06SYSDBA\x1d\tmasterkey0\x04UTF8D\x04UTF8', sql_dialect = 3
2025-05-20 07:01:01.703 charset = 'UTF8', crypt_callback = None
2025-05-20 07:01:01.713
2025-05-20 07:01:01.722 def __make_connection(create: bool, dsn: str, utf8filename: bool, dpb: bytes,
2025-05-20 07:01:01.731 sql_dialect: int, charset: str,
2025-05-20 07:01:01.738 crypt_callback: iCryptKeyCallbackImpl) -> Connection:
2025-05-20 07:01:01.744 with a.get_api().master.get_dispatcher() as provider:
2025-05-20 07:01:01.751 if crypt_callback is not None:
2025-05-20 07:01:01.763 provider.set_dbcrypt_callback(crypt_callback)
2025-05-20 07:01:01.776 if create:
2025-05-20 07:01:01.789 > att = provider.create_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
2025-05-20 07:01:01.801
2025-05-20 07:01:01.810 ../lib/python3.11/site-packages/firebird/driver/core.py:2062:
2025-05-20 07:01:01.820 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-05-20 07:01:01.830
2025-05-20 07:01:01.842 self = <firebird.driver.interfaces.iProvider object at [hex]>
2025-05-20 07:01:01.856 filename = 'inet://tmp_gh_8194_alias'
2025-05-20 07:01:01.868 dpb = b'\x01\x1c\x06SYSDBA\x1d\tmasterkey0\x04UTF8D\x04UTF8', encoding = 'utf-8'
2025-05-20 07:01:01.877
2025-05-20 07:01:01.887 def create_database(self, filename: str, dpb: bytes, encoding: str = 'ascii') -> iAttachment:
2025-05-20 07:01:01.896 "Replaces `isc_create_database()`"
2025-05-20 07:01:01.905 result = self.vtable.createDatabase(self, self.status, filename.encode(encoding), len(dpb), dpb)
2025-05-20 07:01:01.913 > self._check()
2025-05-20 07:01:01.921
2025-05-20 07:01:01.929 ../lib/python3.11/site-packages/firebird/driver/interfaces.py:1305:
2025-05-20 07:01:01.937 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-05-20 07:01:01.946
2025-05-20 07:01:01.957 self = <firebird.driver.interfaces.iProvider object at [hex]>
2025-05-20 07:01:01.966
2025-05-20 07:01:01.974 def _check(self) -> None:
2025-05-20 07:01:01.981 state = self.status.get_state()
2025-05-20 07:01:01.987 if StateFlag.ERRORS in state:
2025-05-20 07:01:01.994 > raise self.__report(DatabaseError, self.status.get_errors())
2025-05-20 07:01:02.003 E firebird.driver.types.DatabaseError: Error reading data from the connection.
2025-05-20 07:01:02.012
2025-05-20 07:01:02.022 ../lib/python3.11/site-packages/firebird/driver/interfaces.py:113: DatabaseError
2025-05-20 07:01:02.031 ---------------------------- Captured stdout setup -----------------------------
2025-05-20 07:01:02.042 Creating db: localhost:/var/tmp/qa_2024/test_11660/test.fdb [page_size=None, sql_dialect=None, charset='NONE', user=SYSDBA, password=masterkey]
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=5.0.3')
def test_1(act: Action, capsys):
if act.get_server_architecture() != 'SuperServer':
pytest.skip('Applies only to SuperServer')
# Scan line-by-line through databases.conf, find line starting with REQUIRED_ALIAS and extract name of file that
# must be created in the $(dir_sampleDb)/qa/ folder. This name will be used further as target database (tmp_fdb).
# NOTE: we have to SKIP lines which are commented out, i.e. if they starts with '#':
p_required_alias_ptn = re.compile( '^(?!#)((^|\\s+)' + REQUIRED_ALIAS + ')\\s*=\\s*\\$\\(dir_sampleDb\\)/qa/', re.IGNORECASE )
fname_in_dbconf = None
with open(act.home_dir/'databases.conf', 'r') as f:
for line in f:
if p_required_alias_ptn.search(line):
# If databases.conf contains line like this:
# tmp_8194_alias = $(dir_sampleDb)/qa/tmp_qa_8194.fdb
# - then we extract filename: 'tmp_qa_8194.fdb' (see below):
fname_in_dbconf = Path(line.split('=')[1].strip()).name
break
# if 'fname_in_dbconf' remains undefined here then propably REQUIRED_ALIAS not equals to specified in the databases.conf!
#
assert fname_in_dbconf
srv_cfg = """
[local]
host = localhost
user = SYSDBA
password = masterkey
"""
srv_cfg = driver_config.register_server(name = 'test_srv_gh_8194', config = '')
db_cfg_name = 'tmp_8194'
db_cfg_object = driver_config.register_database(name = db_cfg_name)
db_cfg_object.server.value = srv_cfg.name
db_cfg_object.protocol.value = NetProtocol.INET
db_cfg_object.database.value = REQUIRED_ALIAS
for i in range(LOOP_LIMIT):
# ::: NB :::
# charset must be 'utf8' otherwise problem can not be reproduced!
# (see also note by the author of ticket in his starting message)
> with create_database(db_cfg_name, user = act.db.user, password = act.db.password, charset = 'utf8') as con:
tests/bugs/gh_8194_test.py:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
database = 'tmp_8194'
def create_database(database: str, *, user: str=None, password: str=None, role: str=None,
no_gc: bool=None, no_db_triggers: bool=None, dbkey_scope: DBKeyScope=None,
crypt_callback: iCryptKeyCallbackImpl=None, charset: str=None,
overwrite: bool=False, auth_plugin_list=None,
session_time_zone: str=None) -> Connection:
"""Creates new database.
Arguments:
database: DSN or Database configuration name.
user: User name.
password: User password.
role: User role.
no_gc: Do not perform garbage collection for this connection.
no_db_triggers: Do not execute database triggers for this connection.
dbkey_scope: DBKEY scope override for connection.
crypt_callback: Callback that provides encryption key for the database.
charset: Character set for connection.
overwrite: Overwite the existing database.
auth_plugin_list: List of authentication plugins override
session_time_zone: Session time zone [Firebird 4]
Hooks:
Event `.ConnectionHook.ATTACHED`: Executed before `Connection` instance is
returned. Hook must have signature::
hook_func(connection: Connection) -> None
Any value returned by hook is ignored.
"""
db_config = driver_config.get_database(database)
if db_config is None:
db_config = driver_config.db_defaults
db_config.database.value = database
if db_config.server.value is None:
srv_config = driver_config.server_defaults
else:
srv_config = driver_config.get_server(db_config.server.value)
if srv_config is None:
raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
else:
if db_config.server.value is None:
srv_config = driver_config.server_defaults
else:
srv_config = driver_config.get_server(db_config.server.value)
if srv_config is None:
raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
if user is None:
user = db_config.user.value
if user is None:
user = srv_config.user.value
if password is None:
password = db_config.password.value
if password is None:
password = srv_config.password.value
if role is None:
role = db_config.role.value
if charset is None:
charset = db_config.charset.value
if charset:
charset = charset.upper()
if auth_plugin_list is None:
auth_plugin_list = db_config.auth_plugin_list.value
if session_time_zone is None:
session_time_zone = db_config.session_time_zone.value
dsn = _connect_helper(db_config.dsn.value, srv_config.host.value, srv_config.port.value,
db_config.database.value, db_config.protocol.value)
dpb = DPB(user=user, password=password, role=role, trusted_auth=db_config.trusted_auth.value,
sql_dialect=db_config.db_sql_dialect.value, timeout=db_config.timeout.value,
charset=charset, cache_size=db_config.cache_size.value,
no_linger=db_config.no_linger.value, utf8filename=db_config.utf8filename.value,
no_gc=no_gc, no_db_triggers=no_db_triggers, dbkey_scope=dbkey_scope,
dummy_packet_interval=db_config.dummy_packet_interval.value,
config=db_config.config.value, auth_plugin_list=auth_plugin_list,
session_time_zone=session_time_zone, set_bind=db_config.set_bind.value,
decfloat_round=db_config.decfloat_round.value,
decfloat_traps=db_config.decfloat_traps.value,
overwrite=overwrite, db_cache_size=db_config.db_cache_size.value,
forced_writes=db_config.forced_writes.value, page_size=db_config.page_size.value,
reserve_space=db_config.reserve_space.value, sweep_interval=db_config.sweep_interval.value,
db_sql_dialect=db_config.db_sql_dialect.value, db_charset=db_config.db_charset.value)
> return __make_connection(True, dsn, db_config.utf8filename.value,
dpb.get_buffer(for_create=True), db_config.sql_dialect.value,
charset, crypt_callback)
../lib/python3.11/site-packages/firebird/driver/core.py:2242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
create = True, dsn = 'inet://tmp_gh_8194_alias', utf8filename = None
dpb = b'\x01\x1c\x06SYSDBA\x1d\tmasterkey0\x04UTF8D\x04UTF8', sql_dialect = 3
charset = 'UTF8', crypt_callback = None
def __make_connection(create: bool, dsn: str, utf8filename: bool, dpb: bytes,
sql_dialect: int, charset: str,
crypt_callback: iCryptKeyCallbackImpl) -> Connection:
with a.get_api().master.get_dispatcher() as provider:
if crypt_callback is not None:
provider.set_dbcrypt_callback(crypt_callback)
if create:
> att = provider.create_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
../lib/python3.11/site-packages/firebird/driver/core.py:2062:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iProvider pytest object at [hex]>
filename = 'inet://tmp_gh_8194_alias'
dpb = b'\x01\x1c\x06SYSDBA\x1d\tmasterkey0\x04UTF8D\x04UTF8', encoding = 'utf-8'
def create_database(self, filename: str, dpb: bytes, encoding: str = 'ascii') -> iAttachment:
"Replaces `isc_create_database()`"
result = self.vtable.createDatabase(self, self.status, filename.encode(encoding), len(dpb), dpb)
> self._check()
../lib/python3.11/site-packages/firebird/driver/interfaces.py:1305:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iProvider pytest object at [hex]>
def _check(self) -> None:
state = self.status.get_state()
if StateFlag.ERRORS in state:
> raise self.__report(DatabaseError, self.status.get_errors())
E firebird.driver.types.DatabaseError: Error reading data from the connection.
../lib/python3.11/site-packages/firebird/driver/interfaces.py:113: DatabaseError
|