]> git.kaiwu.me - njs.git/commit
Modules: fix clearTimeout() of a timer from its own callback master
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 30 Oct 2026 05:30:31 +0000 (22:30 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 2 Nov 2026 14:42:35 +0000 (06:42 -0800)
commitdfbcbe9033a184f9185c03d3241d763207241df0
treec4b80ad5e7b2e48b6c58590f3be86dd4c367b599
parent493cfbc75d6e401da7720ca0ee90b915ddede4dc
Modules: fix clearTimeout() of a timer from its own callback

Previously, the timer event was removed from the pending events after
its callback was called.  When the callback called clearTimeout() for
its own timer, the event was removed twice, which corrupted the
events tree.  In QuickJS, the timer function and arguments were also
freed while the function was still running, and then freed again.

Now, the timer event is removed from the pending events before the
callback is called, and its data is freed after the callback returns.

The issue was introduced in 9de30135 (0.8.3).
nginx/ngx_js.c
nginx/t/js_async.t