Skip to content

Conversation

sashaodessa
Copy link
Contributor

Description

  • What: Replace potentially panicking Duration subtraction with saturating_sub when computing sleep_duration.
  • Why: Duration - Duration panics on negative results; long‑lived read txs could crash the monitor thread.
  • How: In crates/storage/libmdbx-rs/src/txn_manager.rs (read_transactions::start_monitor), compute:
    READ_TRANSACTIONS_CHECK_INTERVAL.min(self.max_duration.saturating_sub(max_active_transaction_duration.unwrap_or_default())).

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not useful


// Sleep not more than `READ_TRANSACTIONS_CHECK_INTERVAL`, but at least until
// the closest deadline of an active read transaction
// Use saturating_sub to avoid panic when active duration exceeds max_duration
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you guys need to stop writing comments like this

this has 0 benefit without the pr as context

@mattsse mattsse closed this Oct 14, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Reth Tracker Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants