FirebirdSQL / fdb

Firebird Driver for Python
https://www.firebirdsql.org/en/devel-python-driver/
Other
60 stars 26 forks source link

error parsing Firebird trace log #14

Open hmoffatt opened 4 years ago

hmoffatt commented 4 years ago

I'm getting exceptions parsing trace logs.

  File "./conv.py", line 12, in <module>
    for event in data:
  File "/home/hamish/tmp/fdb/.pyvenv/lib/python3.7/site-packages/fdb/trace.py", line 972, in parse
    for rec in (self.parse_event(x) for x in self._iter_trace_blocks(lines)):
  File "/home/hamish/tmp/fdb/.pyvenv/lib/python3.7/site-packages/fdb/trace.py", line 972, in <genexpr>
    for rec in (self.parse_event(x) for x in self._iter_trace_blocks(lines)):
  File "/home/hamish/tmp/fdb/.pyvenv/lib/python3.7/site-packages/fdb/trace.py", line 959, in parse_event
    return self._parse_block(record_parser)
  File "/home/hamish/tmp/fdb/.pyvenv/lib/python3.7/site-packages/fdb/trace.py", line 941, in _parse_block
    result = parser()
  File "/home/hamish/tmp/fdb/.pyvenv/lib/python3.7/site-packages/fdb/trace.py", line 660, in __parser_start_transaction
    self._parse_attachment_info(values)
  File "/home/hamish/tmp/fdb/.pyvenv/lib/python3.7/site-packages/fdb/trace.py", line 299, in _parse_attachment_info
    pad, s = attachment_id.split('_')
ValueError: too many values to unpack (expected 2)

The input trace is as simple as

2020-04-07T17:06:29.4110 (5080:001FC38C) START_TRANSACTION
    C:\PROGRAM FILES (X86)\FIREBIRD\FIREBIRD_2_5\SECURITY2.FDB (ATT_3555, SYSDBA:NONE, NONE, <internal>)
        (TRA_9474, CONCURRENCY | WAIT | READ_ONLY)

2020-04-07T17:06:29.4110 (5080:001FC38C) ROLLBACK_TRANSACTION
    C:\PROGRAM FILES (X86)\FIREBIRD\FIREBIRD_2_5\SECURITY2.FDB (ATT_3555, SYSDBA:NONE, NONE, <internal>)
        (TRA_9474, CONCURRENCY | WAIT | READ_ONLY)
      0 ms, 1 fetch(es), 1 mark(s)

2020-04-07T17:06:29.4160 (5080:001F0C1C) TRACE_INIT
    SESSION_16 IBE_7/04/2020 5:06:17 PM

It looks like it's getting confused by the underscores in the Firebird install path. If I change the FIREBIRD_2_5 to something without underscores in the trace then the error goes away.