Skip to content

Title: Hard-committed transaction causes false "update conflicts" on SuperClassic (5.0.3 and 5.0.4) #9017

@Peter-1-1

Description

@Peter-1-1

Title: Hard-committed transaction causes false "update conflicts" on SuperClassic (5.0.3 and 5.0.4)

Overview

A transaction that has been fully committed via COMMIT_TRANSACTION (hard commit) continues to be seen as active/concurrent by new attachments for up to 10+ minutes after the commit. This causes false deadlock / update conflicts with concurrent update errors referencing the already-committed transaction number.

The bug is confirmed on Firebird 5.0.3 (build 1683) and Firebird 5.0.4 (build 1812) under SuperClassic architecture.

This appears related to #8541 (fix-version 5.0.4), but the fix did not resolve this scenario.

Affected Versions

  • affect-version: 5.0.3, 5.0.4
  • Architecture: SuperClassic
  • OS: Ubuntu Linux x64
  • Hardware: 124GB RAM, 32-core AMD EPYC, NVMe RAID10 (dedicated DB server)

Steps to Reproduce

The issue occurs under concurrent load with multiple attachments from different source IPs modifying the same table. It has been observed with two different tables (T_URGENT_OPERS and REPL$LOG) and three different client applications (php-fpm7.2, php8.3, IBReplicator), confirming it is not application-specific.

Evidence: Firebird 5.0.4 (2026-05-01)

Transaction TRA_327149913 — committed successfully

2026-05-01T05:59:07.3460 START_TRANSACTION
    /data/INOUT-FB.FDB (ATT_190168728, REPL_R4:NONE, NONE, TCPv4:77.78.30.33/44328)
    /opt/IBReplicator/replserver:1575986
        (TRA_327149913, CONCURRENCY | WAIT | READ_WRITE)

[... executes SELECTs and DELETE FROM REPL$LOG WHERE SEQNO<=1011222617 ...]

2026-05-01T05:59:08.5220 COMMIT_TRANSACTION
    /data/INOUT-FB.FDB (ATT_190168728, REPL_R4:NONE, NONE, TCPv4:77.78.30.33/44328)
    /opt/IBReplicator/replserver:1575986
        (TRA_327149913, CONCURRENCY | WAIT | READ_WRITE)
      0 ms, 1 read(s), 16 write(s), 1 fetch(es), 1 mark(s)

Hard commit at 05:59:08.522, no errors.

False deadlock errors referencing TRA_327149913 AFTER commit

New IBReplicator attachments attempt DELETE FROM REPL$LOG WHERE SEQNO<=1011222525 (a subset of already-deleted-and-committed rows):

2026-05-01T06:07:36.7340 ERROR AT JStatement::execute
    /data/INOUT-FB.FDB (ATT_190196062, REPL_R4:NONE, NONE, TCPv4:77.78.30.33/54960)
335544336 : deadlock
335544451 : update conflicts with concurrent update
335544878 : concurrent transaction number is 327149913

2026-05-01T06:08:39.1270 ERROR AT JStatement::execute
    /data/INOUT-FB.FDB (ATT_190198069, REPL_R4:NONE, NONE, TCPv4:77.78.30.33/53506)
335544336 : deadlock
335544451 : update conflicts with concurrent update
335544878 : concurrent transaction number is 327149913

2026-05-01T06:09:45.1120 ERROR AT JStatement::execute
    /data/INOUT-FB.FDB (ATT_190201072, REPL_R4:NONE, NONE, TCPv4:77.78.30.33/58926)
335544336 : deadlock
335544451 : update conflicts with concurrent update
335544878 : concurrent transaction number is 327149913
  • Error 1: 8 minutes 28 seconds after commit
  • Error 2: 9 minutes 31 seconds after commit
  • Error 3: 10 minutes 37 seconds after commit

All three are from different attachments (ATT_190196062, ATT_190198069, ATT_190201072) — these are new connections, not long-lived ones with stale snapshots.

Evidence: Firebird 5.0.3 (2026-03-20) — same bug, different table

Transaction TRA_5791473 — committed successfully

2026-03-20T11:57:37.1090 START_TRANSACTION
    /data/TIP-TOP.FDB (ATT_4424969, SYSDBA:NONE, UTF8, TCPv4:172.16.3.85/49054)
    /usr/sbin/php-fpm7.2:3112708
        (TRA_5791473, CONCURRENCY | NOWAIT | READ_WRITE)

[... UPDATE T_URGENT_OPERS, INSERT T_WAYBILL_STATUSES_HISTORY ...]

2026-03-20T11:57:37.1230 COMMIT_TRANSACTION
    /data/TIP-TOP.FDB (ATT_4424969, SYSDBA:NONE, UTF8, TCPv4:172.16.3.85/49054)
        (TRA_5791473, CONCURRENCY | NOWAIT | READ_WRITE)
      0 ms, 1 read(s), 18 write(s), 1 fetch(es), 1 mark(s)

False deadlock errors referencing TRA_5791473 AFTER commit

2026-03-20T11:58:01.9540 ERROR (ATT_4425687, TCPv4:172.16.3.90)
    concurrent transaction number is 5791473
    At procedure 'P_SET_AWB_STATUS' line: 10
    At procedure 'P_SET_WH_SOFIA_STATUS' line: 22

2026-03-20T11:59:02.2300 ERROR (ATT_4427481, TCPv4:172.16.3.90)
    concurrent transaction number is 5791473

2026-03-20T12:00:01.5340 ERROR (ATT_4429365, TCPv4:172.16.3.90)
    concurrent transaction number is 5791473
  • Error 1: 24 seconds after commit
  • Error 2: 85 seconds after commit
  • Error 3: 144 seconds after commit

Different attachments, different source IP (172.16.3.90 vs 172.16.3.85), different application (php8.3 vs php-fpm7.2).

Impact

  1. False update conflicts: Transactions that should succeed are rejected.
  2. Stale reads (silent data inconsistency): If an attachment sees a committed transaction as active, it reads the OLD record version instead of the new one. Unlike update conflicts, stale reads produce NO error — the application silently works with outdated data.
  3. ACID violation: The Isolation guarantee of MVCC is broken — two concurrent connections can read different versions of the same committed data.

Analysis

The common factor across both cases:

  • SuperClassic architecture: each attachment has its own page cache
  • Hard COMMIT_TRANSACTION: not COMMIT_RETAINING
  • New attachments: the failing connections are brand-new (different ATT numbers, different source ports), not long-lived connections with old snapshots
  • TIP page propagation: after commit, the TIP (Transaction Inventory Page) is updated on disk, but other attachments' cached TIP copies are not invalidated/refreshed, so they continue to see the transaction as active

This is NOT #8541 (which was fixed in 5.0.4 for a replica journal scenario). The pattern here occurs on a primary (non-replica) server with regular application workload.

Relationship to Other Issues

Configuration

ServerMode = SuperClassic
DefaultDbCachePages = 8192
TempCacheLimit = 536870912          # 512MB
ReadConsistency = 1
GCPolicy = cooperative
ConnectionIdleTimeout = 60
MaxStatementCacheSize = 0           # disabled
MaxParallelWorkers = 32
ParallelWorkers = 20
DataTypeCompatibility = 2.5
AuthServer = Legacy_Auth, Srp, WinSspi
WireCrypt = Disabled
UserManager = Legacy_UserManager

Note: ReadConsistency = 1 is enabled — this uses the ReadConsistency snapshot isolation mode introduced in Firebird 4. This may be relevant as it changes how transaction snapshots and record version visibility are managed internally.

Server: 124GB RAM, 32-core AMD EPYC 4585PX, NVMe RAID10 (dedicated database server, no other services).
Concurrent sources: php-fpm7.2 (172.16.3.85, 172.16.3.87), php8.3 (172.16.3.90), IBReplicator (77.78.30.33). Approximately 100-200 concurrent connections during the observed incidents.

Trace Logs

Full fbtracemgr trace logs for both incidents are available upon request.

fb_debug_log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions