The Configuration module currently raises EventEmitter.defaultMaxListeners to 50 at import time:
https://github.com/apify/crawlee/blob/refactor/configuration-class-redesign/packages/core/src/configuration.ts#L10-L13
Crawlee attaches many listeners to shared EventEmitters (one per crawler/session/autoscaled pool), which can exceed Node's default limit of 10 and trigger spurious MaxListenersExceededWarning logs. The current placement at module top-level avoids the warnings, but it's an opaque global side effect of importing a value-object module — surprising and hard to discover.
Possible directions (to be explored later):
- Set
setMaxListeners(50, emitter) on the specific EventEmitter instances Crawlee owns, rather than mutating the global default.
- Move the assignment into a lazily-invoked initialization path (e.g. crawler startup) so importing
Configuration has no side effect.
- Drop the bump entirely if real-world listener counts no longer hit the threshold.
Spun off from the Configuration class redesign PR review.
The
Configurationmodule currently raisesEventEmitter.defaultMaxListenersto 50 at import time:https://github.com/apify/crawlee/blob/refactor/configuration-class-redesign/packages/core/src/configuration.ts#L10-L13
Crawlee attaches many listeners to shared
EventEmitters (one per crawler/session/autoscaled pool), which can exceed Node's default limit of 10 and trigger spuriousMaxListenersExceededWarninglogs. The current placement at module top-level avoids the warnings, but it's an opaque global side effect of importing a value-object module — surprising and hard to discover.Possible directions (to be explored later):
setMaxListeners(50, emitter)on the specificEventEmitterinstances Crawlee owns, rather than mutating the global default.Configurationhas no side effect.Spun off from the Configuration class redesign PR review.