corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

MaxListenersExceededWarning on complex data models #112

Closed jcourington closed 4 years ago

jcourington commented 4 years ago

On very complex data models you can get warning and eventually fail with the following message.

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 101 "bind" listeners added. Use emitter.setMaxListeners() to increase limit.

As the message states this can be fixed with a configuration change.

sekur commented 4 years ago

@jcourington - can you elaborate on steps to reproduce? I don't think this would result in failure since max listeners for EventEmitter is just a warning... but I don't think we should be attaching so many listeners during schema evaluation anyways.

I suspect this may be due to the deferred processing of custom extensions (if your YANG module defines new extension elements) and the new extensions are used throughout your data model (more than 100 of them?). I'm thinking that we should only listen for a new 'bind' event once per-extension but wanted to first confirm with you that I'm looking at the proper culprit.

sekur commented 4 years ago

I found another potential bind listener which may be the actual origin for this on a large data model that contains 100+ configurable node elements.