Skip to content

Bound replay wake-lock lifetime when the filter-stall watchdog is exhausted #1631

Open

Description

@coderabbitai

Summary

Investigate and bound the replay lifetime when the filter-stall watchdog reaches EXHAUSTED in the SDK sync flow.

This finding was raised in #1584. @HashEngineering reported that the affected code is now identical to the base branch after merging feat/kotlin-sdk-phase-1 at 647624cff, and that the code previously landed through #1568. Triage and fix this separately against feat/kotlin-sdk-phase-1, not as part of the contested-username fee changes.

Reported behavior and risk

The review found that:

  • replayActive remains true while blockPipelineLagging is true.
  • The blockchain service skips idle shutdown while replaying and acquires the replay wake lock without a timeout.
  • The wake lock is released when replaying becomes false or during service destruction.
  • The watchdog's EXHAUSTED branch only logs, leaving no bounded terminal recovery path.

If confirmed on the target branch, a parked block pipeline can keep the service and replay wake lock active indefinitely.

Required changes

  1. Verify the watchdog, replay-state, and wake-lock lifecycle on the target branch.
  2. Propagate terminal watchdog exhaustion to the service as an explicit failure or bounded recovery outcome, or implement another bounded recovery path.
  3. Release the replay wake lock and allow normal idle shutdown when recovery is exhausted.
  4. Preserve accurate incomplete-scan state. Do not mark unfinished replay as successfully completed merely to release the wake lock.
  5. Preserve safe retry and restart behavior for interrupted replay.

Affected areas

  • wallet/src/de/schildbach/wallet/service/platform/sdk/L1ShadowSyncService.kt: watchdog exhaustion handling and replay lifecycle.
  • wallet/src/de/schildbach/wallet/service/platform/sdk/SdkBlockchainStateMapper.kt: propagation of replay lifecycle state.
  • wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.kt: replay wake-lock ownership and idle shutdown.
  • FilterStallWatchdogDecider: terminal watchdog decision.

Acceptance criteria

  • A test covers watchdog exhaustion while the block pipeline still lags.
  • Exhaustion cannot leave the replay wake lock held indefinitely.
  • The service can resume normal idle shutdown after terminal recovery.
  • Unfinished scan work is not reported as successful replay completion.
  • Tests cover normal replay completion and retry/restart behavior after exhaustion.

References

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

Metadata

Metadata

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