Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Potential EventEmitter memory leak for element explorer #2200

Closed
bootstraponline opened this issue Jun 2, 2015 · 12 comments
Closed

Potential EventEmitter memory leak for element explorer #2200

bootstraponline opened this issue Jun 2, 2015 · 12 comments

Comments

@bootstraponline
Copy link

My experience with protractor 2.1.0 with the latest stable release of node (0.12.x) has been:

  1. Start element explorer
  2. Enter any command
  3. Watch REPL hang indefinitely

Even if the REPL processes the first command properly, it'll freeze up within the next few commands. In addition, there's often this message:

(node) warning: possible EventEmitter memory leak detected. 11 break listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Client.addListener (events.js:179:15)
at Client.Readable.on (stream_readable.js:671:33)
at CommandRepl.evaluate
(/usr/local/lib/node_modules/protractor/lib/debugger/modes/commandRepl.js:106:15)
at CommandRepl.stepEval (/usr/local/lib/node_modules/protractor/lib/debugger/modes/commandRepl.js:34:8)
at REPLServer.stepEval (/usr/local/lib/node_modules/protractor/lib/debugger/clients/explorer.js:95:13)
at bound (domain.js:254:14)
at REPLServer.runBound as eval
at REPLServer. (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)

@hankduan
Copy link
Contributor

hankduan commented Jun 3, 2015

duplicate of #1890?

@bootstraponline
Copy link
Author

I don't see EventEmitter memory leak detected mentioned in #1890.

@hankduan hankduan changed the title Element explorer is still mostly broken on node 0.12 Potential EventEmitter memory leak for element explorer Jun 4, 2015
@hankduan
Copy link
Contributor

hankduan commented Jun 4, 2015

Can you provide me with some steps to reproduce this? I'm on 2.1.0 and node 0.12.4, but cannot observe the memory leak behavior you mentioned.

@bootstraponline
Copy link
Author

Press enter 20 times in the REPL.

@juliemr
Copy link
Member

juliemr commented Jun 4, 2015

I also cannot reproduce this. Could you share the system you are on, and your command line for starting element explorer?

@bootstraponline
Copy link
Author

$ node -v
v0.12.4

OS X 10.10.3

$ protractor --version
Version 2.1.0

In tab1 I run java -jar selenium-server-standalone-2.45.0.jar and in tab2

protractor --elementExplorer --browser firefox --seleniumAddress http://127.0.0.1:4444/wd/hub

Here is a screen recording I just made that showcases the problem.

@hankduan
Copy link
Contributor

hankduan commented Jun 5, 2015

Ok, yes I see what you're doing now.

The problem arises when you send additional commands (new line is a command too) while previous commands are loading. For example, sending enters while it is loading browser.get('http://www.angulrjs.org') in your video.

The reason is that elementexplorer handles one command at a time (in order to wait for the result of the command). On sending command, it sets up an event listener to wait for the response. Once the result for that command is received, it would clean up the event listener. However, because you're sending multiple commands simultaneously, you're actually creating multiple event listeners before it had the chance to clean up. You won't break element explorer, but yes you will get warnings. (also note that all commands sent while element explorer is waiting for responses will not be processed).

Hopefully that clears up the issue here.

@bootstraponline
Copy link
Author

The behavior is confusing, especially compared to a Ruby or Python REPL. It sounds like it's working as intended though. Thanks for explaining.

@hankduan
Copy link
Contributor

hankduan commented Jun 5, 2015

That's because normal REPL wouldn't try to resolve a promise before returning.
i.e. if you type $('abcd').getText(), it would return the promise, whereas protractor waits for the result of the promise and returns that.

@hankduan hankduan removed their assignment Nov 4, 2015
@benjaminapetersen
Copy link

Quick note, I can reproduce this on Protractor 5.x in the REPL. Not sure if its still expected to see Warning: Possible EventEmitter memory leak detected.

@demisx
Copy link

demisx commented Sep 15, 2018

Seeing similar error in protractor 5.4.1 and node 10.9.0 on Mac OS Sierra running 9 e2e specs and not touching keyboard or any input device for that matter at all.

(node:53205) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit

@djangofan
Copy link

Sorry for commenting on this closed story, but there is no comment here explaining why it was closed.

I am experiencing the exact same issue as @demisx using Protractor 7.0.0 with npm 8.1.0 and node v16.13.0 . Running headless tests serially. Using browser.restartAsync between each test.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants