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

'EADDRINUSE' when debugging, despite no other processes using 5858 #2039

Closed
spamguy opened this issue Apr 12, 2015 · 16 comments
Closed

'EADDRINUSE' when debugging, despite no other processes using 5858 #2039

spamguy opened this issue Apr 12, 2015 · 16 comments

Comments

@spamguy
Copy link

spamguy commented Apr 12, 2015

I'm pretty new to the Protractor debugging scene, so kindly bear with me. Running OSX 10.10, Node 0.12.0, and Protractor 2.0.0 installed locally via grunt-protractor-runner. The compy's firewall is off.

I have a test that fails to work as expected. My intention, then, was to throw in a browser.debugger() and then run protractor in debug mode.

I did a quick check to make sure nothing was running on port 5858:

$ netstat -ant | grep 5858
$

Then I started Protractor and immediately got an EADDRINUSE error:

$ ./node_modules/grunt-protractor-runner/node_modules/protractor/bin/protractor debug protractor-local.conf.js 
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Starting debugger agent.
Debugger listening on port 5858
< Error: listen EADDRINUSE
<     at exports._errnoException (util.js:746:11)
<     at Agent.Server._listen2 (net.js:1129:14)
<     at listen (net.js:1155:10)
<     at Agent.Server.listen (net.js:1240:5)
<     at Object.start (_debugger_agent.js:20:9)
<     at startup (node.js:86:9)
<     at node.js:814:3
connecting to port 5858... ok

I exited and tried the first command, only to find still nothing is running on 5858. It's as if it's blocking itself.

@juliemr
Copy link
Member

juliemr commented Apr 16, 2015

Confirmed that this is specific to node 0.12. (Quick fix, downgrade to 0.10 if you can).

@adamduren
Copy link

I am experiencing this issue as well.

@toutpt
Copy link

toutpt commented May 18, 2015

Same here using :

  • node 0.12.3
  • protractor 2.0.0

@rightisleft
Copy link

+1
protractor v 2.1.0

@JLLeitschuh
Copy link
Contributor

Still experiencing this problem. I'm trying to debug a grunt script that runs at the end of protractor tests. Any workarounds for this?

  • Node v0.12.4
  • grunt-cli v0.1.13
  • grunt v0.4.5
  • protractor v2.1.0
  • grunt-protractor-runner v2.0.0

I also tried launching the debugger on a different port to make sure that there weren't any conflicts and still had this problem.

@david-gang
Copy link

same problem here. @juliemr - What is the source of the problem? Is this a bug in nodejs? I am already in nodejs 0.12 and cannot downgrade.

I think it is connected to nodejs/node#1282 . I have no idea when this is/was released. It looks like a node 1.x branch. This is interesting, as we have now just 0.12. If this is connected, it should be solved in a future node upgrade.

@david-gang
Copy link

Update:

I updated to nodejs 0.12.7 and saw if the error consists.

Here it is quite different:
When i use the debug option i get the debugger console. I have to press c to start the protractor tests. When i get to browser pause the system fails. This is because of the onportavailable function in protractor.js

var onPortAvailable = function(port, fn) {
    console.log("ports is "+ port);
    var net = require('net');
    var tester = net.connect({port: port}, function() {
      console.error('Port ' + port + ' is already in use. Please specify ' +
        'another port to debug.');
      process.exit(1);
    });
    tester.once('error', function (err) {
      if (err.code === 'ECONNREFUSED') {
        tester.once('close', fn).end();
      } else {
        console.error('Unexpected failure testing for port ' + port + ': ',
          err);
        process.exit(1);
      }
    });

We are already in the debugger and it tries to connect again to the same port.

If i don't specify the browser.pause line, i get

Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)

Now comes my most intersting observation :-)

When i don't pass the debug option, suddenly everything works and i get into the wd-debug console with browser.pause Maybe this was intended to work as standalone without supplying the debug option :-)

@javiercr
Copy link

Same problem with node 4.1.2 and protractor 2.5.1.

@melnikaite
Copy link

The same error running express via nodemon --debug ./bin/www
node v4.2.1
node-inspector v0.12.3
nodemon v1.7.1
express v4.13.3

@juliemr
Copy link
Member

juliemr commented Nov 18, 2015

Possibly related to #2206? Also assigning to @hankduan

@juliemr juliemr added this to the 3.1 milestone Nov 18, 2015
@hankduan
Copy link
Contributor

hankduan commented Dec 4, 2015

Sorry, I'm not clear what the issue is. Can someone clarify?

Here's what I see:

$ bin/protractor debug /workspace/protractor/spec/hankConf.js --suite hank 
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Starting debugger agent.
Debugger listening on port 5858
connecting to localhost:5858 ... ok
break in timers.js:56
 54 };
 55 
>56 function listOnTimeout() {
 57   var msecs = this.msecs;
 58   var list = this;
debug> 

Spec:

describe('foo', function() {
  it('bar', function() {
    browser.debugger();
    browser.get('https://angularjs.org');
  });
});

The results is what I'm expecting.

@juliemr
Copy link
Member

juliemr commented Jan 31, 2016

Haven't heard any updates, so I'm going to close this. Please open a new issue if there's still a problem.

@juliemr juliemr closed this as completed Jan 31, 2016
@fgather
Copy link

fgather commented Feb 9, 2016

Sorry to dig this up, but is this related to the problem that node passes the --debug-brk to a forked nodejs process without changing the debug port?
(http://stackoverflow.com/questions/19252310/how-to-fork-a-child-process-that-listens-on-a-different-debug-port-than-the-pare)

@kingluddite
Copy link

My solution was to check for port numbers and see if servers were running on them.

$ lsof -i:3000

Will generate the list of processes. Grab the PID and kill it.

$ kill -9 $pid
  • replace the $pid with the actual PID

Do the same for port 5858.

I like this solution better than restarting.

@viyoma
Copy link

viyoma commented Oct 17, 2016

kill all the process using this command
TASKKILL /F /IM cmd.exe /T

@Pritesh-D
Copy link

@viyoma worked for me !!!

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

No branches or pull requests

15 participants