mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-11-09 12:21:25 -10:00
* fix(js): prevent pool slot starvation under load Zombie goroutines from timed-out JS executions held pool slots indefinitely: Add() blocked with context.Background(), and defer Done() only ran when the goroutine eventually completed. Under load, both pools (80 pooled + 20 non-pooled slots) filled with zombies, silently dropping all subsequent matches. Three changes fix slot lifecycle management: 1. Propagate the 20s deadline context into ExecuteProgram (compiler.go) so both execution paths can respect the deadline. 2. Replace Add() with AddWithContext(ctx) in both pool.go and non-pool.go so goroutines waiting for a slot fail fast when the deadline expires instead of blocking indefinitely. 3. Add a watchdog goroutine that releases the slot when the deadline expires, even if the zombie is still running. An atomic.Bool ensures exactly one Done() call between the watchdog and the normal defer path. * adding context * refactor(js): derived the ctx to remaining tractable deadline leaks (#7302) * refactor(js): use `context.Background` as default instead Signed-off-by: Dwi Siswanto <[email protected]> * refactor(js): derived the ctx to remaining tractable deadline leaks Signed-off-by: Dwi Siswanto <[email protected]> * test(js): add `NucleiJS.Context` tests Signed-off-by: Dwi Siswanto <[email protected]> * fix(cmd): context param exclusion in memoization hash The memoization template condition for excluding context parameters from hash keys was incorrect. The memoize package represents context.Context types as "&{context Context}" (AST string representation), not "context.Context". Signed-off-by: Dwi Siswanto <[email protected]> * chore(js): memogen'ed Signed-off-by: Dwi Siswanto <[email protected]> --------- Signed-off-by: Dwi Siswanto <[email protected]> * fix(js): hangs in checkRDPEncryption by bounding socket I/O Add `setConnDeadlineFromContext` helper to set deadlines on conns derived from context timeouts. Move conn cleanup out of loop-scoped defers to make sure immediate cleanup per probe attempt. Signed-off-by: Dwi Siswanto <[email protected]> --------- Signed-off-by: Dwi Siswanto <[email protected]> Co-authored-by: Niek den Breeje <[email protected]> Co-authored-by: Dwi Siswanto <[email protected]> Co-authored-by: Dwi Siswanto <[email protected]>