Skip to content

fix: release dns_cache reference on timer rearm path#478

Open
PikuZheng wants to merge 3 commits into
masterfrom
codex/investigate-memory-increase-after-3-days
Open

fix: release dns_cache reference on timer rearm path#478
PikuZheng wants to merge 3 commits into
masterfrom
codex/investigate-memory-increase-after-3-days

Conversation

@PikuZheng

Copy link
Copy Markdown
Owner

Motivation

  • Hourly-step memory increases were traced to dns_cache_expired() holding a dns_cache reference when the timeout callback returned UPDATE/RETRY and dns_timer_mod() was attempted but not accounted for, leading to transient retained references during concentrated expirations.
  • The change ensures timer rearm failure cannot leave the timer-held cache reference unreleased so periodic cleanup (e.g. hourly maintenance) does not cause observable RSS step-ups.

Description

  • Ensure dns_cache_release() is always called on the UPDATE/RETRY out path in src/dns_cache.c so a failed dns_timer_mod() does not omit releasing the held cache reference.
  • Remove the unused mod_ret variable and simplify the dns_timer_mod() calls so the release is unconditional on the out path.
  • Preserve existing behavior for the DEL and OK branches and only change the handling around timer rearm and release.

Testing

  • Built the whole project with make -j2 and the build completed successfully.
  • Recompiled the changed unit with make -C src dns_cache.o and the compilation completed successfully.

Codex Task

@liouxunhuan8

Copy link
Copy Markdown

[edns.ipk]这个edns是代表什么版本?

@PikuZheng

Copy link
Copy Markdown
Owner Author

[edns.ipk]这个edns是代表什么版本?

编译时附加参数 CFLAGS="-DFEATURE_CHECK_EDNS"
据说是对上游的附加edns消息进行检查,如果上游没有返回正确的edns,则丢弃该查询结果(这是一个很久前遗留下来的,我也不知道是不是这样

@liouxunhuan8

Copy link
Copy Markdown

[edns.ipk]这个edns是代表什么版本?

编译时附加参数 CFLAGS=“-DFEATURE_CHECK_EDNS” 据说是对上游的附加edns消息进行检查,如果上游没有返回正确的edns,则丢弃该查询结果(这是一个很久前遗留下来的,我也不知道是不是这样

感谢解释

@liouxunhuan8

Copy link
Copy Markdown

最新的2026.v48.0.15
好像找不到aarch64-openwrt-edns.ipk
luci-compat-all.ipk 怎么整?

@PikuZheng

Copy link
Copy Markdown
Owner Author

最新的2026.v48.0.15 好像找不到aarch64-openwrt-edns.ipk luci-compat-all.ipk 怎么整?

编译失败了呗

@PikuZheng

Copy link
Copy Markdown
Owner Author

最新的2026.v48.0.15 好像找不到aarch64-openwrt-edns.ipk luci-compat-all.ipk 怎么整?

改好了

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants