You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
events: on() leaves emitter paused after return() #67917
Traced this to closeHandler in lib/events.js. When the buffer fills past highWatermark, eventHandler pauses the emitter, and the only resume path is in next() when the buffer drains below lowWatermark. closeHandler just clears the local paused flag, so after return() the emitter stays paused for good and nothing ever resumes it.
Fix is in closeHandler: if paused, call emitter.resume() before clearing the flag, same guard next() already uses. Adding a regression test in test-events-on-async-iterator.js that checks isPaused() is false after return() with a filled buffer.
Activity
bunnysayzz commentedon Dec 1, 2026
Traced this to closeHandler in lib/events.js. When the buffer fills past highWatermark, eventHandler pauses the emitter, and the only resume path is in next() when the buffer drains below lowWatermark. closeHandler just clears the local paused flag, so after return() the emitter stays paused for good and nothing ever resumes it.
Fix is in closeHandler: if paused, call emitter.resume() before clearing the flag, same guard next() already uses. Adding a regression test in test-events-on-async-iterator.js that checks isPaused() is false after return() with a filled buffer.
PR: #67942
events: resume emitter only on early return of async iterator