Skip to content

stream.eventNames() broken on 21.2.0+ #51302

@Qard

Description

@Qard

Version

v21.2.0

Platform

Darwin COMP-JX471G9FQQ 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64 arm Darwin

Subsystem

streams

What steps will reproduce the bug?

Use stream.eventNames() on a stream and you'll find it reports having event listeners for events which it does not actually have listeners for due to this _events pre-allocation change which released in 21.2.0.

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior? Why is that the expected behavior?

stream.eventNames() should only return names of events for which there actually are listeners.

What do you see instead?

All expected event types report having listeners because it's based on Reflect.ownKeys(...) which will see the explicit undefined keys as present and assume that means there are listeners for that event name.

Additional information

No response

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.streamIssues and PRs related to the stream subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions