Skip to content

fix: quiet benign duplicate-HTLC EF errors and disable sensitive-data logging in prod - #544

Open
markettes wants to merge 2 commits into
mainfrom
fix/excessive-log-htlc-error
Open

fix: quiet benign duplicate-HTLC EF errors and disable sensitive-data logging in prod#544
markettes wants to merge 2 commits into
mainfrom
fix/excessive-log-htlc-error

Conversation

@markettes

Copy link
Copy Markdown
Contributor

Production logs were being flooded with large Error-level entries every time a
duplicate ForwardingHtlcEvent was inserted (composite PK collision, Postgres 23505).

These duplicates are expected and already handled: ForwardingHtlcEventRepository.UpsertAsync
catches the unique-violation and skips the row. But two things made them noisy anyway:

  1. EF Core logs the failure independently of our catch. During the failing command EF
    emits RelationalEventId.CommandError and CoreEventId.SaveChangesFailed at Error — a full
    SQL command + parameter dump and a complete stack trace — before the exception ever reaches
    our handler. Serilog pins Microsoft to Warning, but these are Error, so they passed through.
  2. Sensitive-data logging was on in prod. AddDbContextFactory<ApplicationDbContext> called
    EnableSensitiveDataLogging() + EnableDetailedErrors() unconditionally, dumping raw parameter
    values (node pubkeys, HTLC amounts, peer aliases) into every failed-command log — both noise
    and a privacy concern.

@markettes
markettes requested a review from Jossec101 July 29, 2026 09:40
@Jossec101

Copy link
Copy Markdown
Contributor

Nack, can't we handle this without removing logging? is the unique really what I thought it should be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants