ProgressNS / sidekick-feedback

This repository is for feedback regarding NativeScript Sidekick. Use the issues system here to submit feature requests or vote for existing ones.
45 stars 9 forks source link

EventEmitter memory leak detected (v 5.1.0) #325

Closed NL33 closed 5 years ago

NL33 commented 5 years ago

Please, provide the details below:

Did you verify whether this issue has already been reported here?

Yes

Tell us about the problem

Received the error, detailed on the logs below, which shut down the app:

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

This happened about an hour or so after creating a new app with sidekick (NS+angular+typescript) and running it successfully on my iphone. The app itself was very simple: just one component (home), and the only plugins downloaded were UI Listview and Local Storage.

The home html and ts had the code (just a RadListView) listed at this playground: https://play.nativescript.org/?template=play-ng&id=M0M7Lp&v=41

The app was working fine on my phone, and then I received this error after a minor edit (removing a style on the html).

Afterward, I switched over to loading the app ($ tns run ios) on my terminal, and it has worked fine since (have not received the error on the terminal).

Which platform(s) does the issue occur on?

_iOS 11.4.1 (that is the phone it was running on)
_macOS, 10.13.6

Provide the following version numbers that the issue occurs with:

Tell us how to recreate the issue in as much detail as possible

N/A (see above description and below logs)

Does this issue happen every time?

Yesterday was first time building a new app with Sidekick. The error persisted when I tried to rebuild after I first received the error. I have not tried again since as I switched to building on terminal.

Send the client logs

here is the snippet I believe to be relevant: this should show the change from when the app worked on my phone to no longer working:

[19-01-08 11:14:14.182] (Info) ab.liveSync.shell.liveSyncStopped - {"projectDir":"[[app_name","deviceIdentifier":"[[edited]]","device":{"identifier":"[[edited]]","vendor":"Apple","platform":"iOS","status":"Connected","errorHelp":null,"type":"Device","isTablet":false,"displayName":"iPhone","version":"11.4.1","color":"[[edited]]","activeArchitecture":"[[edited]]"}}
[19-01-08 11:14:14.360] (Info) ab.buildDeploy.shell.canChangeWebpackOption - true
[19-01-08 11:14:14.363] (Info) ab.connectedDevices.ui.devicesListChanged
…

\"\n","Status bar could not find cached time string image. Rendering in-process.\n","NativeScript debugger received Error Domain=NSPOSIXErrorDomain Code=57 \"Socket is not connected\". Disconnecting.\n","NativeScript debugger encountered 
Error Domain=NSPOSIXErrorDomain Code=57 \"Socket is not connected\".\n","NativeScript debugger has opened inspector socket on port 18183 for [[app_id]]\n"],"platform":"iOS","selected":true,"status":"Connected","type":"Device","unauthorized":false,"vendor":"Apple","version":"11.4.1"}}

[19-01-08 11:14:27.069] (Error) ab.childProcessCommunication.shell.cliStderr - (node:36794) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 deviceLost listeners added. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:243:17)
    at IOSDeviceLibStdioHandler.addListener (events.js:259:10)
    at Promise (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/index.js:165:35)
    at new Promise (<anonymous>)
    at IOSDeviceLib._getPromise (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/index.js:103:10)
    at deviceIdentifiers.map.di (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/index.js:78:43)
    at Array.map (<anonymous>)
    at IOSDeviceLib.apps (/usr/local/lib/node_modules/nativescript/node_modules/ios-device-lib/index.js:78:28)
    at getMultipleResults (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:91:65)
    at IOSDeviceOperations.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:198:30)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:13:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:9:12)
    at IOSDeviceOperations.getMultipleResults (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:196:16)
    at IOSDeviceOperations.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/device/ios-device-operations.js:91:25)
ggarabedian commented 5 years ago

@NL33, thank you for sharing the exact error message and detailed information about the problem.

We suspect that the issue is occurring only in Sidekick because the terminal is a short living process. In comparison, some of the processes in Sidekick remain active until you shut it down. With this in mind, if you open different apps in Sidekick, build and deploy them multiple times, you might see this error. Restarting Sidekick will most likely resolve the issue.

Having said that, this is not the expected behavior and would help us a lot if you can share the complete Sidekick logs - the entire file that is generated from the moment you start Sidekick, to the moment you observe this error. This information will help us to identify what steps you use in your workflow and which are the most probable processes that might cause this issue.

NL33 commented 5 years ago

Thanks. I will take a look. Is your impression that this is a sidekick error, and not an error in the app?

I would assume so given the simplicity of the app and the fact that I have only ever seen this error in sidekick.

ggarabedian commented 5 years ago

@NL33, the issue is in the tooling - to be precise, in the specifics of how Sidekick communicates with the NativeScript CLI in comparison to using the CLI from a terminal. The issue is definitely not related to your application.

NL33 commented 5 years ago

Thank you for your follow-up and info on this.