]> git.kaiwu.me - njs.git/commit
Modules: removed shared dict expiration from read-locked paths.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 27 Mar 2026 01:03:41 +0000 (18:03 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 30 Mar 2026 23:53:46 +0000 (16:53 -0700)
commitc3a4725a1f17c4dbedba6a8d2046322174bbcd80
treeaae0a570a0de5cdc48e822d46de7b8e6b35be6a5
parent983427973b96a3c6293a6aa6ace7c859b28f35aa
Modules: removed shared dict expiration from read-locked paths.

Previously, keys(), items(), and size() called ngx_js_dict_expire()
under a read lock.  Since ngx_js_dict_expire() deletes nodes from
both rbtrees and frees slab memory, concurrent readers on different
worker processes could corrupt shared memory by freeing the same
expired nodes simultaneously.

The fix removes ngx_js_dict_expire() calls from all read-locked
paths and instead skips expired entries during iteration, consistent
with how get() and has() already handle expiry.  Actual cleanup of
expired entries is deferred to write-side operations (set, add,
delete, clear).
nginx/ngx_js_shared_dict.c