-
-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
Hello!
I am trying to read the output from a trace session, but it looks like the readline()
call blocks indefinitely. This is the snippet I am using to reproduce the issue on a fresh Firebird install with firebird 3.0.7 on Debian 11:
from multiprocessing import Process
import time
srv_cfg = """\
[local]
host = localhost
user = SYSDBA
password = masterkey
"""
db_cfg = """\
[employee]
server = local
database = employee.fdb
protocol = inet
"""
def start_tracing():
from firebird.driver import driver_config, connect_server
driver_config.register_server('local', srv_cfg)
driver_config.register_database('employee', db_cfg)
trace_config = """\
database
{
max_log_size = 123123123
log_statement_prepare = false
log_statement_start = true
log_statement_finish = false
log_procedure_start = true
log_procedure_finish = false
log_function_start = true
log_function_finish = false
log_trigger_start = true
log_trigger_finish = false
log_initfini = false
log_dyn_requests = true
max_sql_length = 30000
max_dyn_length = 20000
max_arg_length = 300
max_arg_count = 100
}
services
{
}
database = %
{
enabled = true
}
"""
with connect_server('local') as srv:
trace_id = srv.trace.start(config=trace_config, name='test_trace_1')
trace_log = []
for i in range(10):
print('trying to read a line...')
trace_log.append(srv.readline())
with connect_server('local') as srv_aux:
srv_aux.trace.stop(session_id=trace_id)
def start_work():
from firebird.driver import driver_config, connect
driver_config.register_server('local', srv_cfg)
driver_config.register_database('employee', db_cfg)
with connect('employee') as con:
cur = con.cursor()
for i in range(0, 10):
cur.execute("select country, currency from country")
print('sql worker process: fetched %d rows' % len(cur.fetchall()))
time.sleep(1)
if __name__ == '__main__':
p_trace = Process(target=start_tracing, args=())
p_trace.start()
time.sleep(5)
p_work = Process(target=start_work, args=())
p_work.start()
p_work.join()
p_trace.join()
When running the same trace config via fbtracemgr
it works:
fbtracemgr -service localhost:service_mgr -user SYSDBA -pass masterkey -name test -start -config test-trace.conf
Should I do something different in the python code to get it working ?
P.S This is my test virtualenv with python 3.9:
firebird-base==1.3.1
firebird-driver==1.4.3
protobuf==3.20.1
python-dateutil==2.8.2
six==1.16.0
Regards,
Hristo Stefanov
Metadata
Metadata
Assignees
Labels
No labels