Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECONNREFUSED since v1.1.0 #317

Closed
laedit opened this issue Jun 25, 2016 · 14 comments
Closed

ECONNREFUSED since v1.1.0 #317

laedit opened this issue Jun 25, 2016 · 14 comments

Comments

@laedit
Copy link

laedit commented Jun 25, 2016

Since the update of the 1.1.0 of web-ext I have the ECONNREFUSED error when using web-ext run.
Here are the logs, edited from some connection retry:

Version: 1.1.0
[cmd/run.js][info] Running web extension from src
[util/manifest.js][debug] Validating manifest at src\manifest.json
[cmd/run.js][debug] Creating new Firefox profile
[cmd/run.js][debug] Deferring extension installation until after connecting to the remote debugger
[firefox/index.js][info] Running Firefox with profile at D:\System\Temp\6500a841-98ea-4ca7-844f-78b61c8a6f85
[firefox/index.js][debug] Checking if remote Firefox port 6005 is available
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[firefox/index.js][debug] Executing Firefox binary: C:\Program Files\Firefox Developer Edition\firefox.exe
[firefox/index.js][debug] Firefox args: --start-debugger-server 6005 -foreground -no-remote -profile D:\System\Temp\6500a841-98ea-4ca7-844f-78b61c8a6f85
[firefox/index.js][info] Use --verbose or open Tools > Web Developer > Browser Console to see logging
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (1); connection error: Error: connect ECONNREFUSED
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (2); connection error: Error: connect ECONNREFUSED
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[firefox/index.js][debug] Firefox stderr: JavaScript strict warning: resource://gre/modules/Webapps.jsm, line 1162: ReferenceError: reference to undefined property msg.app
[firefox/index.js][debug] Firefox stderr: JavaScript strict warning: chrome://browser/content/tabbrowser.xml, line 640: ReferenceError: reference to undefined property this.mBrowser.initialPageLoadedFromURLBar
[cmd/run.js][debug] Retrying Firefox (3); connection error: Error: connect ECONNREFUSED
[firefox/remote.js][debug] Connecting to Firefox on port 6005
...
[cmd/run.js][debug] Retrying Firefox (25); connection error: Error: connect ECONNREFUSED
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Connect to Firefox debugger: too many retries
[cmd/run.js][error] Error: connect ECONNREFUSED
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
[program.js][error]
run: Error: connect ECONNREFUSED
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)

[program.js][error] run: Error code: ECONNREFUSED

[firefox-profile] cannot delete profileDir on exit D:\System\Temp\6500a841-98ea-4ca7-844f-78b61c8a6f85 { [Error: EBUSY, resource busy or locked 'D:\System\Temp\6500a841-98ea-4ca7-844f-78b61c8a6f85\cert8.db']
  errno: -4082,
  code: 'EBUSY',
  path: 'D:\\System\\Temp\\6500a841-98ea-4ca7-844f-78b61c8a6f85\\cert8.db',
  syscall: 'unlink' }

I am on Windows 10 and using the latest Firefox Developer Edition (49.0a2 (2016-06-23)).

Do I need to allow the port 6005 in my firewall, or does this come from firefox?
I haven't see the usual 'incoming connection' firefox window, is this normal?

Thanks.

@pastak
Copy link

pastak commented Jun 26, 2016

It also happens on my Firefox Nightly with MacOSX 10.10.5

@rpl
Copy link
Member

rpl commented Jun 27, 2016

@kumar303 I looked into the "Windows" part of this issue, and it looks like it is not a Firewall issue but the different rules for the command line flag syntax (basically Firefox.exe on Windows doesn't recognize the "--" version of the command line flag, but it does work correctly with a "single dash" version of the same command line flag, "-start-debugger-server" in our case)

The fix have to be applied on the fx-runner npm package (and I've opened mozilla/node-fx-runner#21 with the proposed fix).

@kumar303
Copy link
Contributor

@rpl thanks! I released a new runner with your patch (and updated web-ext in #320) but I don't know if that will fix it.

@kumar303
Copy link
Contributor

kumar303 commented Jun 27, 2016

@laedit it's possible that the argument change may fix this (for Windows at least). Could you try to build/install web-ext from master and try it? Here are instructions: https://github.com/mozilla/web-ext#installation-from-source

@pastak Could you paste --verbose output for this failure on Mac OS X?

@pastak
Copy link

pastak commented Jun 27, 2016

@kumar303 Thanks for your response. My --verbose output is here

Version: 1.1.0
[cmd/run.js][info] Running web extension from dist/firefox
[util/manifest.js][debug] Validating manifest at dist/firefox/manifest.json
[cmd/run.js][debug] Creating new Firefox profile
[cmd/run.js][debug] Deferring extension installation until after connecting to the remote debugger
[firefox/index.js][info] Running Firefox with profile at /var/folders/fp/y4wd5rbj5dd2vw5s2jd7w78m0000gn/T/543d4dac-6e82-4ee4-ba29-0242f2c5dee8
[firefox/index.js][debug] Checking if remote Firefox port 6005 is available
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[firefox/index.js][debug] Executing Firefox binary: /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
[firefox/index.js][debug] Firefox args: --start-debugger-server 6005 -foreground -no-remote -profile /var/folders/fp/y4wd5rbj5dd2vw5s2jd7w78m0000gn/T/543d4dac-6e82-4ee4-ba29-0242f2c5dee8
[firefox/index.js][info] Use --verbose or open Tools > Web Developer > Browser Console to see logging
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (1); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (2); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (3); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (4); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (5); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (6); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (7); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (8); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (9); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (10); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (11); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (12); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (13); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (14); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (15); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (16); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (17); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (18); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (19); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (20); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (21); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (22); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (23); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (24); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Retrying Firefox (25); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[firefox/remote.js][debug] Connecting to Firefox on port 6005
[cmd/run.js][debug] Connect to Firefox debugger: too many retries
[cmd/run.js][error] Error: connect ECONNREFUSED 127.0.0.1:6005
    at Object.exports._errnoException (util.js:855:11)
    at exports._exceptionWithHostPort (util.js:878:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
[program.js][error]
run: Error: connect ECONNREFUSED 127.0.0.1:6005
    at Object.exports._errnoException (util.js:855:11)
    at exports._exceptionWithHostPort (util.js:878:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)

[program.js][error] run: Error code: ECONNREFUSED

@kumar303
Copy link
Contributor

Thanks for the logs. Since I don't see any indication that Firefox has had enough time to start up, I think the connection is timing out prematurely. In fact, the timeout was only 6 seconds. I proposed a patch that increases the timeout to 30 seconds: #324

It should also be possible to work around any remote debugger issues by using --pre-install, a patch I am proposing in #323

I will report back when these patches are on master.

@kumar303
Copy link
Contributor

ok, these patches have landed on master.

Could either of you try building/installing from source to see if fixed the problem? Here are instructions: https://github.com/mozilla/web-ext#installation-from-source

@laedit
Copy link
Author

laedit commented Jun 28, 2016

I have tried but I encounter some error when npm run build:

Aborted due to warnings.

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v4.4.6
npm ERR! npm  v3.10.2
npm ERR! code ELIFECYCLE
npm ERR! web-ext@1.1.0 build: `node -e "require('grunt').cli()" null build`
npm ERR! Exit status 3

I have tried to npm install grunt with and without the -g parameter but it doesn't work.
I also have some warning during npm install:

npm WARN optional Skipping failed optional dependency /watchpack/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /webpack/watchpack/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]

Have I missed something?
The build has already been tested on windows?

@kumar303
Copy link
Contributor

Huh, odd. It looks like ELIFECYCLE just means the process failed to spawn. The warnings about fsevents shouldn't matter because that's an optional dependency. I don't know if anyone has tried building this on windows actually :| but @rpl has a machine that he can try it on.

@kumar303
Copy link
Contributor

kumar303 commented Jun 28, 2016

@laedit did you upgrade npm after installing web-ext? It looks like you encountered an npm installation bug. One way to be sure would be to remove the node_modules directory inside your web-ext source directory and re-run npm install using npm version 3.10.2, then try npm run build again.

@laedit
Copy link
Author

laedit commented Jun 29, 2016

That was that, I can npm run build now.
But I have some errors when running web-ext -s "src" run --firefox-binary "C:\Program Files\Firefox Developer Edition\firefox.exe" --verbose:

Version: 1.1.0
[src\cmd\run.js][info] Running web extension from src
[src\util\manifest.js][debug] Validating manifest at src\manifest.json
[src\cmd\run.js][debug] Creating new Firefox profile
[src\cmd\run.js][debug] Deferring extension installation until after connecting to the remote debugger
[src\firefox\index.js][info] Running Firefox with profile at D:\System\Temp\1ba6085c-4be4-4ae4-b15f-39f38a07a658
[src\firefox\index.js][debug] Checking if remote Firefox port 6005 is available
[src\firefox\remote.js][debug] Connecting to Firefox on port 6005
[src\firefox\index.js][debug] Executing Firefox binary: C:\Program Files\Firefox Developer Edition\firefox.exe
[src\firefox\index.js][debug] Firefox args: -start-debugger-server 6005 -foreground -no-remote -profile D:\System\Temp\1ba6085c-4be4-4ae4-b15f-39f38a07a658
[src\firefox\index.js][info] Use --verbose or open Tools > Web Developer > Browser Console to see logging
[src\cmd\run.js][info] Connecting to the remote Firefox debugger
[src\firefox\remote.js][debug] Connecting to Firefox on port 6005
[src\cmd\run.js][debug] Retrying Firefox (1); connection error: Error: connect ECONNREFUSED 127.0.0.1:6005
[src\firefox\remote.js][debug] Connecting to Firefox on port 6005
[src\firefox\index.js][debug] Firefox stdout: Started debugger server on 6005
[src\firefox\remote.js][debug] Connected to the remote Firefox debugger
[src\cmd\run.js][debug] Connected to the Firefox debugger
[src\firefox\index.js][debug] Firefox stderr: JavaScript strict warning: resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/security/socket.js, line 736: ReferenceError: reference to undefined property this._handshakeTimeout
[src\firefox\index.js][debug] Firefox stdout: console.error:
[src\firefox\index.js][debug] Firefox stdout: Message: Error: Could not install add-on at 'src': [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]"  nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_P
ATH)"  location: "JS frame :: resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/addons.js :: AddonsActor<.installTemporaryAddon< :: line 23"  data: no]
  Stack:
    AddonsActor<.installTemporaryAddon<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/addons.js:26:13
TaskImpl.prototype._run@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/task.js:310:39
TaskImpl@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/task.js:272:3
createAsyncFunction/asyncFunction@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/task.js:246:14
generateRequestHandlers/</handler@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/protocol.js:1046:19
DSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/main.js:1648:15
DebuggerTransport.prototype._onJSONObjectReady/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/transport/transport.js:479:11
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
[src\program.js][error]
run: WebExtError: installTemporaryAddon: Error: unknownError: Could not install add-on at 'src': [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]"  nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_P
ATH)"  location: "JS frame :: resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/addons.js :: AddonsActor<.installTemporaryAddon< :: line 23"  data: no]
    at C:\Users\man-p\Downloads\web-ext - master\web-ext\dist\webpack:\src\firefox\remote.js:85:29
    at EventEmitter.extend.handleMessage (C:\Users\man-p\Downloads\web-ext - master\web-ext\node_modules\firefox-client\lib\client.js:161:7)
    at EventEmitter.extend.readMessage (C:\Users\man-p\Downloads\web-ext - master\web-ext\node_modules\firefox-client\lib\client.js:220:10)
    at EventEmitter.extend.onData (C:\Users\man-p\Downloads\web-ext - master\web-ext\node_modules\firefox-client\lib\client.js:186:16)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at TCP.onread (net.js:536:20)

[firefox-profile] cannot delete profileDir on exit D:\System\Temp\1ba6085c-4be4-4ae4-b15f-39f38a07a658 { [Error: EBUSY: resource busy or locked, unlink 'D:\System\Temp\1ba6085c-4be4-4ae4-b15f-39f38a07a658\cert8.db']
  errno: -4082,
  code: 'EBUSY',
  syscall: 'unlink',
  path: 'D:\\System\\Temp\\1ba6085c-4be4-4ae4-b15f-39f38a07a658\\cert8.db' }

I had some errors during npm install but it seems that they are not related:

> [email protected] install C:\web-ext - master\web-ext\node_modules\dtrace-provider
> node scripts/install.js


> [email protected] postinstall C:\web-ext - master\web-ext\node_modules\spawn-sync
> node postinstall


> [email protected] postinstall C:\web-ext - master\web-ext\node_modules\grunt-flowbin\node_modules\flow-bin
> node lib/install.js

  × No binary found matching your system. It's probably not supported.
  × flow binary test failed

> [email protected] postinstall C:\web-ext - master\web-ext\node_modules\flow-bin
> node lib/install.js

  × No binary found matching your system. It's probably not supported.
  × flow binary test failed

@kumar303
Copy link
Contributor

kumar303 commented Jun 29, 2016

@laedit hmm, this might be a bug in that we aren't converting to an absolute path. To confirm, could you see if it works with a full path? Something like : web-ext -s "D:\full\path\to\src" run ... ?

@laedit
Copy link
Author

laedit commented Jun 29, 2016

It was that, it works perfectly now, thank you! 😃
Do you want me to submit a new issue for the relative path?

@kumar303
Copy link
Contributor

Thanks for testing this out! Fixed in #324

I filed #332 to track the --source-dir issue. BTW, I can also reproduce it on Mac OS X.

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

No branches or pull requests

4 participants