GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Evict DNS cache entries when expiration tasks are cancelled by hellboy0621 · Pull Request #18389 · netty/netty

Conversation

@hellboy0621

@hellboy0621 hellboy0621 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Motivation:

When an EventLoop terminates, its DNS cache expiration tasks are cancelled but their entries remain. A reused shared cache can return stale records indefinitely.

Modification:

Evict entries when the active expiration task is cancelled. Ignore superseded timers and handle cancellation before listener registration. Add regression coverage for positive and negative entries, cache reuse and timer replacement.

Result:

Entries are evicted early when their expiration task is cancelled, preventing indefinite retention without adding a scheduler. All four regression cases fail before the fix and pass afterwards. The DNS suite reports 359 tests, 17 skipped and zero failures with leak detection enabled. The resolver-dns reactor passes verify, including Checkstyle and API compatibility checks. The leak log check passes.

Fixes #17042.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hellboy0621
Evict DNS cache entries when expiration tasks are cancelled
6977684
Motivation:

DNS cache expiration tasks are cancelled when their EventLoop terminates,
but the corresponding cache entries remain. A shared cache can therefore
keep returning stale records indefinitely after the original loop closes.

Modification:

Listen for cancellation of the active expiration task and evict its
entries. Ignore cancellation of superseded timers when shortening a TTL,
and handle cancellation before the listener is registered.

Add regression tests for positive and negative entries, cache reuse,
replacement timers and cancellation before schedule returns.

Result:

Entries whose expiration task is cancelled are evicted early instead of
remaining cached indefinitely. All four regression cases fail before the
fix and pass afterwards. The DNS suite reports 359 tests, 17 skipped and
no failures with leak detection enabled. The resolver-dns reactor passes
verify, including Checkstyle and API compatibility checks, and the leak
log check passes.

Fixes netty#17042.
@normanmaurer normanmaurer added this to the 4.2.21.Final milestone Nov 13, 2026
@normanmaurer normanmaurer added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Nov 13, 2026
normanmaurer
normanmaurer approved these changes Nov 13, 2026
View reviewed changes
@testlens-app

testlens-app Bot commented Nov 13, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 6977684
▶️ Tests: 36990 executed
⚪️ Checks: 30/30 completed


Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer merged commit bcb81f7 into netty:4.2 Nov 13, 2026
31 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 4.1.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #18392

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot netty-project-bot mentioned this pull request Nov 13, 2026
Auto-port 5.0: Evict DNS cache entries when expiration tasks are cancelled #18392
Merged
@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Nov 13, 2026
@normanmaurer normanmaurer mentioned this pull request Nov 13, 2026
Port 4.1: Evict DNS cache entries when expiration tasks are cancelled (#18389) #18393
Merged
@normanmaurer

normanmaurer commented Nov 13, 2026

Copy link
Copy Markdown
Member

Ported to 4.1: #18393

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Nov 13, 2026
normanmaurer added a commit that referenced this pull request Nov 13, 2026
@normanmaurer
Fix 5.0 compile errors in auto-port of DNS cache eviction
5aba9d1
Motivation:

The auto-port of #18389 does not compile on 5.0 because FutureListener.operationComplete takes Future<? extends V> there, and DefaultEventLoop no longer exists.

Modification:

Declare operationComplete(Future<?>) in Cache.Entries and use SingleThreadIoEventLoop with LocalIoHandler in CacheTest.

Result:

resolver-dns builds on 5.0 and CacheTest passes.
chrisvest pushed a commit that referenced this pull request Nov 13, 2026
@netty-project-bot @hellboy0621 @normanmaurer
Auto-port 5.0: Evict DNS cache entries when expiration tasks are canc…
baaec98
…elled (#18392)

Auto-port of #18389 to 5.0
Cherry-picked commit: bcb81f7

---
Motivation:

When an EventLoop terminates, its DNS cache expiration tasks are
cancelled but their entries remain. A reused shared cache can return
stale records indefinitely.

Modification:

Evict entries when the active expiration task is cancelled. Ignore
superseded timers and handle cancellation before listener registration.
Add regression coverage for positive and negative entries, cache reuse
and timer replacement.

Result:

Entries are evicted early when their expiration task is cancelled,
preventing indefinite retention without adding a scheduler. All four
regression cases fail before the fix and pass afterwards. The DNS suite
reports 359 tests, 17 skipped and zero failures with leak detection
enabled. The resolver-dns reactor passes verify, including Checkstyle
and API compatibility checks. The leak log check passes.

Fixes #17042.

---------

Co-authored-by: hellboy0621 <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
chrisvest pushed a commit that referenced this pull request Nov 13, 2026
@normanmaurer @hellboy0621
Port 4.1: Evict DNS cache entries when expiration tasks are cancelled (…
b735c7a
…#18389) (#18393)

Motivation:

Port of #18389 to 4.1.

When an EventLoop terminates, its DNS cache expiration tasks are
cancelled but their entries remain. A reused shared cache can return
stale records indefinitely.

Modification:

Cherry-pick of bcb81f7. The only conflict was in the imports of
`Cache.java` (both `PlatformDependent` and the new
`Future`/`FutureListener` imports are kept). Entries are now evicted
when the active expiration task is cancelled; superseded timers are
ignored and cancellation before listener registration is handled.

Result:

Fixes #17042.

Not run locally: the build sandbox could not resolve Maven dependencies,
so `CacheTest` was not compiled or executed here. Relying on CI.

---------

Co-authored-by: hellboy0621 <[email protected]>
@lhotari lhotari mentioned this pull request Nov 17, 2026
[improve][build] Upgrade Netty to 4.2.21.Final to restore the aarch64 glibc floor and pick up bug fixes apache/pulsar#27654
Merged
1 of 11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@normanmaurer normanmaurer normanmaurer approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.21.Final

Development

Successfully merging this pull request may close these issues.

TTL DNS cache removal relies on Channel's EventLoop lifecycle

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@hellboy0621 @netty-project-bot @normanmaurer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.