Skip to content

[v7.x] fix(session cache): fix bug in tls session caching (#5882) - #6017

Merged
mcollina merged 1 commit into
nodejs:v7.xfrom
mrityunjay-pandey:backport/v7.x-tls-session-cache
Oct 15, 2026
Merged

mcollina merged 1 commit into
nodejs:v7.xfrom
mrityunjay-pandey:backport/v7.x-tls-session-cache

Conversation

@mrityunjay-pandey

Copy link
Copy Markdown

This relates to...

Backport of #5882 to v7.x.

Rationale

WeakSessionCache.set() on v7.x has the bug fixed by #5882. When the cache is full and it finds an entry whose session was already collected, it deletes that entry and then returns, so the new session is never stored. With a full cache, a new TLS session is silently dropped whenever there is a dead entry to clean up.

v6.x is not affected: its WeakSessionCache has no eviction logic, which came in with #5102.

Changes

Features

N/A

Bug Fixes

  • TLS session cache: a new session is stored after an expired entry is evicted.

Breaking Changes and Deprecations

N/A

Status

Tested locally on Linux with Node 24: npm run test:unit (1322 tests, 1319 pass, 3 skipped, 0 fail) and npm run lint.

Spotted this one by accident. In the tls session cache,
nodejs#5102 added logic
to remove dead entries and make room, but the check
used an early return that short circuited the cache
operation.

Signed-off-by: James M Snell <jasnell@gmail.com>
(cherry picked from commit d983b4f)
Signed-off-by: Mrityunjay Pandey <mrityunjayp1409@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.12%. Comparing base (0c74bec) to head (f333785).

Additional details and impacted files
@@            Coverage Diff             @@
##             v7.x    #6017      +/-   ##
==========================================
+ Coverage   93.11%   93.12%   +0.01%     
==========================================
  Files         112      112              
  Lines       37366    37372       +6     
==========================================
+ Hits        34793    34804      +11     
+ Misses       2573     2568       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollina
mcollina merged commit 1dc0696 into nodejs:v7.x Oct 15, 2026
37 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 15, 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