Skip to content

backfill: drop history sync notifications that keep failing to download - #1086

Open
indent[bot] wants to merge 4 commits into
mainfrom
indent/whatsapp-drop-undecodable-history-sync
Open

indent[bot] wants to merge 4 commits into
mainfrom
indent/whatsapp-drop-undecodable-history-sync

Conversation

@indent

@indent indent Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Logs

Failed to download history sync 758 in 24 h (prev 2). Nearly all of it is one account retrying once a minute since Nov 21 17:00 UTC. Loki sample (15 min, at least 1 account): the same FULL chunk 37 (progress 79) fails every minute with failed to decompress: unexpected EOF.

Cause

DownloadHistorySync checks the blob hashes before decompressing, so the payload itself is truncated and retrying can't succeed. historySyncLoop always takes the oldest queued notification and only deletes it on 403/404/410. This notification is retried forever, and every later chunk waits behind it.

Change

The loop counts consecutive failures for the same queued notification, but only failures showing the blob itself is bad (hash/HMAC mismatch, or truncated/corrupt zlib data after a complete download). After 10 of those (~10 min) it logs an error and drops the notification, so the later chunks get processed. Network errors, 5xx, disconnects and DB/handling failures don't count and reset the streak, so an outage never drops a downloadable chunk.

Before / after

Note: not tested against a live account.

Case Base Head
Truncated chunk (failed to decompress: unexpected EOF) queued before 2 good chunks Retried every minute (16 in 15 min); later chunks never stored Dropped after 10 attempts; both later chunks stored
Chunk fails with websocket not connected for 20 min, then recovers Kept and retried; stored after recovery Same

View in Indent
Tag @indent to continue the conversation here.

@indent

indent Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Issues

All clear! No issues remaining. 🎉

1 issue already resolved
  • The new drop branch fires after 10 consecutive failures of any kind from DownloadHistorySync (except 403/404/410), so a ~10 min network outage or reconnect deletes a still-downloadable HSNotif row. The counter also increments on non-download errors (panics, handleWAHistorySync/DB failures). Only count and drop on errors that show the blob is bad (decompress/EOF, HMAC/hash/length mismatch), and don't count while disconnected. (fixed by commit 478b5b1)
    Found by Indent Review Agent

CI Checks

All required CI checks passed on d576ee2.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No issues found
Full results

Indent Review Agent

  • Summary: No issues found
  • Last ran on commit: d576ee22
  • Latest result
    {
      "summary": "No issues found",
      "findings": []
    }

Comment thread pkg/connector/backfill.go Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant