Skip to content

Fix file handle leak in ra_flru:evict_all - #623

Merged
kjnilsson merged 1 commit into
mainfrom
ra-flru-leak
Apr 21, 2026
Merged

kjnilsson merged 1 commit into
mainfrom
ra-flru-leak

Conversation

@kjnilsson

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes ra_flru:evict_all/1 so it returns a properly preserved cache state (including max_size and handler) after evicting all items, preventing downstream callers from unintentionally resetting the handler/max size and leaking resources.

Changes:

  • Update evict_all/1 to return an updated copy of the original state rather than constructing a fresh record with only items = [].
  • Extend the existing EUnit test to assert evict_all/1 preserves max_size and handler.

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ra_flru.erl Resolved
@kjnilsson
kjnilsson requested a review from mkuratczyk April 21, 2026 13:30
@kjnilsson
kjnilsson marked this pull request as ready for review April 21, 2026 13:43

@mkuratczyk mkuratczyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Looks like that's the one indeed - previously I saw FDs leaking within 10-15 minutes of starting the workload, now it's been 40 minutes and no unexpected FDs.

@kjnilsson
kjnilsson merged commit d93be43 into main Apr 21, 2026
12 checks passed
@kjnilsson
kjnilsson deleted the ra-flru-leak branch April 21, 2026 13:57
@michaelklishin michaelklishin added this to the 3.1.6 milestone Apr 21, 2026
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.

4 participants