Skip to content

Fix/1221 reset indexer mutex - #1419

Merged
K1NGD4VID merged 2 commits into
LabsCrypt:mainfrom
GOE001:fix/1221-reset-indexer-mutex
Sep 2, 2026
Merged

Fix/1221 reset indexer mutex#1419
K1NGD4VID merged 2 commits into
LabsCrypt:mainfrom
GOE001:fix/1221-reset-indexer-mutex

Conversation

@GOE001

@GOE001 GOE001 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or update

Related Issues

Closes #1221

Changes Made

Testing

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Test Steps

Breaking Changes

Breaking Changes:

Migration Guide:

Screenshots/Demo

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Updated Postman/Hoppscotch API collections if routes changed
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have checked for breaking changes and documented them if applicable

Additional Notes

GOE001 and others added 2 commits August 31, 2026 11:42
…ge (LabsCrypt#1209)

The pollIndexerForWithdraw loop could run for ~63s with no abort
mechanism, causing stale fetches and state writes after the user
navigated away or switched wallets.

- Thread an AbortController through the polling loop via a useRef
- Abort on component unmount and wallet/publicKey change via useEffect cleanup
- Check signal.aborted before each fetch, state update, and after delay
- Add test verifying unmount mid-backoff stops further fetches

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…LabsCrypt#1221)

resetIndexer wrote IndexerState directly via prisma.indexerState.upsert
without acquiring SorobanEventWorker's batchMutex. If triggered while a
poll batch was in flight, the batch's fetchAndProcessEvents would finish
afterwards and overwrite the reset cursor, silently undoing the admin's
reset/replay.

- Made runExclusive public so the indexer service can acquire the same
  lock that serialises poll/replay batches
- Wrapped resetIndexer's DB write inside runExclusive, ensuring any
  in-flight poll completes before the reset writes, and no subsequent
  batch can overwrite it
- Added test verifying reset during in-flight poll ends with reset cursor
  winning

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@K1NGD4VID
K1NGD4VID merged commit 7a1b6f3 into LabsCrypt:main Sep 2, 2026
11 checks passed
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.

[Audit] resetIndexer/replayFromLedger can be clobbered by an in-flight scheduled poll

2 participants