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

net.Socket.prototype.connect is having TypeError when called without connectionListener #11761

Closed
vhain opened this issue Mar 9, 2017 · 10 comments
Labels
confirmed-bug Issues with confirmed bugs. net Issues and PRs related to the net subsystem.

Comments

@vhain
Copy link
Contributor

vhain commented Mar 9, 2017

net.Socket.prototype.connect should work fine without callback (connectionListener) according to doc

but it's working like this

> (new net.Socket()).connect({ host:'google.com', port:80 })
TypeError: "listener" argument must be a function
    at Socket.once (events.js:307:11)
    at Socket.connect (net.js:943:10)
    at repl:1:20
    at ContextifyScript.Script.runInThisContext (vm.js:23:33)
    at REPLServer.defaultEval (repl.js:336:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.onLine (repl.js:533:10)
    at emitOne (events.js:101:20)
    at REPLServer.emit (events.js:191:7)

related PR: #11667

@tc-mccarthy
Copy link

Amazing. I'm having this same issue after upgrading to the latest version of node and trying to run my application through pm2. I'll be watching closely. Thank you in advance!

@vhain
Copy link
Contributor Author

vhain commented Mar 9, 2017

@tc-mccarthy yes. i was experiencing same thing with pm2 and try to figure out what is the problem.

fyi, for now i came up with downgrading node to 7.7.1

@tc-mccarthy
Copy link

@vhain not really a fix, but a workaround for me was downgrading to node v6.0.0. Things sprung back to life.

@mscdex mscdex added the net Issues and PRs related to the net subsystem. label Mar 9, 2017
@mscdex
Copy link
Contributor

mscdex commented Mar 9, 2017

/cc @joyeecheung

@mscdex mscdex added the v7.x label Mar 9, 2017
@joyeecheung
Copy link
Member

Yeah..it's a bug due to the oversight of #11667, which assumes the options are always normalized but they are not, should've fixed the test coverage before refactoring them, sorry for the inconvenience & thanks for the fix!

@ram-you
Copy link

ram-you commented Mar 10, 2017

Yes I confirm that it's a bug.

@fcanela
Copy link

fcanela commented Mar 10, 2017

We are affected by the same issue. Current version is broken. We switched back to 7.7.1 and everything works again.

@fcanela
Copy link

fcanela commented Mar 10, 2017

I really appreciate the job you are doing and do not mean to introduce any hurry. There is any approximation on when we can expect a working current version? I would appreciate that information to decide if we should make fixes or wait.

vhain added a commit to vhain/node that referenced this issue Mar 10, 2017
Arguments of Socket.prototype.connect should be also normalized,
causing error when called without callback.

Changed Socket.prototype.connect's code same as net.connect and added
test.

Fixes: nodejs#11761
@sam-github
Copy link
Contributor

@nodejs/release When is a 7.7.3 planned? This bug is reported to be present only in 7.7.2 (I have not verified this, but its been noticed reasonably widely)

@fcanela the fix is almost approved for master, but I'm not sure when the next release is planned

@cavacn
Copy link

cavacn commented Mar 13, 2017

I'm having this same issue after upgrading to the latest version of node and trying to run my application through pm2. @vhain ,I use the node 7.7.1, It's work.thanks very much

italoacasas pushed a commit to italoacasas/node that referenced this issue Mar 13, 2017
Arguments of Socket.prototype.connect should be also normalized,
causing error when called without callback.

Changed Socket.prototype.connect's code same as net.connect and added
test.

Fixes: nodejs#11761
PR-URL: nodejs#11762
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
jungx098 pushed a commit to jungx098/node that referenced this issue Mar 21, 2017
Arguments of Socket.prototype.connect should be also normalized,
causing error when called without callback.

Changed Socket.prototype.connect's code same as net.connect and added
test.

Fixes: nodejs#11761
PR-URL: nodejs#11762
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

No branches or pull requests

8 participants