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

https silently stopped working after upgrade to 1.4.1 #988

Closed
kyrylkov opened this issue Feb 27, 2015 · 23 comments
Closed

https silently stopped working after upgrade to 1.4.1 #988

kyrylkov opened this issue Feb 27, 2015 · 23 comments
Labels
confirmed-bug Issues with confirmed bugs. https Issues or PRs related to the https subsystem.

Comments

@kyrylkov
Copy link

https silently stopped working after upgrade to 1.4.1

Browsers and Postman cannot connect to https localhost as if io.js server is not running.

Downgrading to 1.3.0 solves the problem

let bodyParser = require('body-parser'),
    compression = require('compression'),
    express = require('express'),
    fs = require('fs'),
    https = require('https');

const SSL_OPTIONS = {
    key: fs.readFileSync('ssl/hacksparrow-key.pem'),
    cert: fs.readFileSync('ssl/hacksparrow-cert.pem')
};

let app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));

app.use(compression({
    level: 9
}));

app.use(express.static('public'));

require('./routes')(app);

https.createServer(SSL_OPTIONS, app).listen(8443);
console.log('Listening on port 8443 ...');
@micnic micnic added confirmed-bug Issues with confirmed bugs. https Issues or PRs related to the https subsystem. labels Feb 27, 2015
@tellnes
Copy link
Contributor

tellnes commented Feb 27, 2015

Could you try to reduce the test case to only use core modules?

@kyrylkov
Copy link
Author

Reduced to the code below. Still not working. Verified to work with http.

var fs = require('fs'),
    express = require('express'),
    https = require('https');

const SSL_OPTIONS = {
    key: fs.readFileSync('ssl/hacksparrow-key.pem'),
    cert: fs.readFileSync('ssl/hacksparrow-cert.pem')
};

var app = express();

app.get('/', function (req, res) {
    res.send('Hello World!');
});

https.createServer(SSL_OPTIONS, app).listen(8443);
console.log('Listening on port 8443 ...');

@kyrylkov
Copy link
Author

Reduced even more. Not working.

'use strict';

var fs = require('fs'),
    https = require('https');

var options = {
    key: fs.readFileSync('ssl/hacksparrow-key.pem'),
    cert: fs.readFileSync('ssl/hacksparrow-cert.pem')
};

https.createServer(options, function (req, res) {
    res.writeHead(200);
    res.end("hello world\n");
}).listen(8443);
console.log('Listening on port 8443 ...');

@mikeal
Copy link
Contributor

mikeal commented Feb 27, 2015

@indutny any ideas?

@indutny
Copy link
Member

indutny commented Feb 27, 2015

Testing

@indutny
Copy link
Member

indutny commented Feb 27, 2015

Appears to be working on my side :(

var https = require('https');

var options = {
  key: "-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAKBgQCw9x8LLd0Lm/LKGiYheUoRW7Kz8ndiNEXo+ZSLhlYls6sB9Pwp\n1oOybdU7uY6jrscG3lRDeDvF5fKhPUTbI6UA5k+o62iLGYQlLBaikHKbZkxxg7ai\n4bBQMTJgRxsuUQIEaw2KrxsSPjDcwMMVRwaQMkSAiObyIFaN7BN4HnrfQQIDAQAB\nAoGBAKgg+OD9n3Ouo7JIuq511h18weD9/VeTc1IfgPY4WLN0KgXvc/3p3PCSMhMO\nvcqcPGI1q9f4LM3dpLF1DOyoRlPp1KqAw7jybI2KwP3EAuVjbZA6DJRopvXM7yMo\nASYPOsqVW52Gf94Hw3jp16B5NoSzJ7aFjRYd27oCxarmljXLAkEAyI7Nn3UJHqZc\ncnvXy4wgsgnJR3uUR2R+U4a2aiXjgZe+nb1nUrY1ETHH3ZoNA7PwX9CILx32tCE6\nnBLy/TMRwwJBAOHitZN6V98afph55mmp4FdIhgzAgYc7UhCRJWYC7o0HCMsDCByN\nGuYlJi/tAEqcyjE95BR5pFf0JHMhQDwX1qsCQQCK+Ij7CTn8hwJgQfhSDxNIywcy\nBSvGHJh8gEg+XWq8Dc4Dt460/ZTgCUKZB3olKrZRbkove+/K+YuHQoolcRHJAkAx\nTSoUZj+HkmDPJswDg/BTHKElZ17eBTSEKSngegNXBJIGvUKn+KRGVxVeoHvPzSjU\nVo3RajtUdxT9i+RZOVrBAkAsuYxntIDznm2+f+MAQnG9i5vMCvGOq40Jz+2k7vl/\neb5JvCKXA8cncegAtYTyQZVMwsgcGnGTCYoXIIO/4+tY\n-----END RSA PRIVATE KEY-----",
  cert: "-----BEGIN CERTIFICATE-----\nMIIBpTCCARCgAwIBAgIDAQABMAsGCSqGSIb3DQEBCzAPMQ0wCwYDVQQDFgRhYXNk\nMB4XDTcwMDEwMTAwMDAwMFoXDTI1MDIyNDE2MjAxNVowDzENMAsGA1UEAxYEYWFz\nZDCBnTALBgkqhkiG9w0BAQEDgY0AMIGJAoGBALD3Hwst3Qub8soaJiF5ShFbsrPy\nd2I0Rej5lIuGViWzqwH0/CnWg7Jt1Tu5jqOuxwbeVEN4O8Xl8qE9RNsjpQDmT6jr\naIsZhCUsFqKQcptmTHGDtqLhsFAxMmBHGy5RAgRrDYqvGxI+MNzAwxVHBpAyRICI\n5vIgVo3sE3geet9BAgMBAAGjFTATMBEGA1UdEQQKMAiCBiouYWFzZDALBgkqhkiG\n9w0BAQsDgYEAgMgeIsZx6SkQ9YweLhR1YCeiHI+1FRP4SH8D4Z8FN0ddKqi5CmN4\nPTUQgeWcTEb1cjIqxHg5U6DLbKcyq6V8YUcDe/hVgqXUh6rmYQP4oIcjaHVkdAqt\nreAfKuRNgtoQGkowqu2ia25BOKjs7U8ZzALl9Po9P6z8AiMRBeTdKQk=\n-----END CERTIFICATE-----"
};

https.createServer(options, function(req, res) {
  res.writeHead(200);
  res.end('hello world\n');
}).listen(8443, function() {
  console.log('Listening at %j', this.address());
});
~/Code/indutny/node $ ./iojs test.js &
[1] 84265
Listening at {"address":"::","family":"IPv6","port":8443}
~/Code/indutny/node $ curl -k https://127.0.0.1:8443/
hello world
~/Code/indutny/node $ ./iojs -v
v1.4.1

@indutny
Copy link
Member

indutny commented Feb 27, 2015

@kyrylkov does this code work for you?

@benjamingr
Copy link
Member

@indutny I've just replicated OP's code and I can't reproduce this on 1.4.1. Works just fine. Both with your code and his.

Tested with:

var bodyParser = require('body-parser'),
    compression = require('compression'),
    express = require('express'),
    fs = require('fs'),
    https = require('https');

var options = {
  key: "-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0AMIGJAoGBALD3Hwst3Qub8soaJiF5ShFbsrPy\nd2I0Rej5lIuGViWzqwH0/CnWg7Jt1Tu5jqOuxwbeVEN4O8Xl8qE9RNsjpQDmT6jr\naIsZhCUsFqKQcptmTHGDtqLhsFAxMmBHGy5RAgRrDYqvGxI+MNzAwxVHBpAyRICI\n5vIgVo3sE3geet9BAgMBAAGjFTATMBEGA1UdEQQKMAiCBiouYWFzZDALBgkqhkiG\n9w0BAQsDgYEAgMgeIsZx6SkQ9YweLhR1YCeiHI+1FRP4SH8D4Z8FN0ddKqi5CmN4\nPTUQgeWcTEb1cjIqxHg5U6DLbKcyq6V8YUcDe/hVgqXUh6rmYQP4oIcjaHVkdAqt\nreAfKuRNgtoQGkowqu2ia25BOKjs7U8ZzALl9Po9P6z8AiMRBeTdKQk=\n-----END CERTIFICATE-----"
};

var app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));

app.use(compression({
    level: 9
}));

app.use(express.static('public'));
app.get("/", function(req, resp){
    resp.json("Hello World");
    resp.end();
});

https.createServer(options, app).listen(8443);
console.log('Listening on port 8443 ...');

Here's output

@rvagg
Copy link
Member

rvagg commented Feb 27, 2015

Which OS are you using @kyrylkov?

@kyrylkov
Copy link
Author

@rvagg Tested on Windows 10 Pro Build 9926 & Windows 8.1 Pro. Both 64-bit.

@rvagg
Copy link
Member

rvagg commented Feb 27, 2015

We need an @iojs/windows team so we can summon help ...

@indutny
Copy link
Member

indutny commented Feb 27, 2015

@rvagg I'll build io.js in Parallels in a bit. Still it is very surprising since most of https/tls test implies that basic server setup should be working.

@indutny
Copy link
Member

indutny commented Feb 27, 2015

@rvagg oh, just realized that we have binaries! :)

@indutny
Copy link
Member

indutny commented Feb 27, 2015

Hm... confirmed.

@kyrylkov
Copy link
Author

@indutny that's a start

@indutny
Copy link
Member

indutny commented Feb 27, 2015

@kyrylkov thank you :) I'll look into it. So far I could only tell that the connection is accepted and then closed for some reason. Not sure how it passed tests for us on CI.

@kyrylkov
Copy link
Author

@indutny glad to know it's not my messy set-up

@piscisaureus
Copy link
Contributor

@rvagg

We need an @iojs/windows team so we can summon help ...

I wholeheartedly agree. Unfortunately we have a shortage of active windows devs in this community.
I know this is OT (sorry @kyrylkov and @indutny ).

@indutny
Copy link
Member

indutny commented Feb 27, 2015

I think this._handle.readStart() returns something inappropriate.

@indutny
Copy link
Member

indutny commented Feb 27, 2015

Gosh, it return UV__EALREADY. WHY DO YOU WINDOWS LIBUV INCOMPATIBLE WITH UNIXES?! cc @saghul

indutny added a commit to indutny/io.js that referenced this issue Feb 27, 2015
The problem does not manifest itself on unixes, because
`uv_read_start()` always return 0 there. However on Windows on a second
call `uv_read_start()` returns `UV__EALREADY` destroying all sockets on
a read attempt.

Set `.reading` property that is already handled by `net.js` code.

Fix: nodejs#988
@indutny
Copy link
Member

indutny commented Feb 27, 2015

Fix #994 .

@indutny
Copy link
Member

indutny commented Feb 27, 2015

@rvagg It does seem to be a CI problem as well, since we wasn't aware of test failures. There are clearly lots of failing tests (all https and most of tls) on Windows atm.

@rvagg
Copy link
Member

rvagg commented Feb 27, 2015

probably related to the dramas I was having at release, will figure it out

indutny added a commit that referenced this issue Feb 28, 2015
The problem does not manifest itself on unixes, because
`uv_read_start()` always return 0 there. However on Windows on a second
call `uv_read_start()` returns `UV__EALREADY` destroying all sockets on
a read attempt.

Set `.reading` property that is already handled by `net.js` code.

Fix: #988
PR-URL: #994
Reviewed-By: Chris Dickinson <[email protected]>
@rvagg rvagg closed this as completed Feb 28, 2015
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. https Issues or PRs related to the https subsystem.
Projects
None yet
Development

No branches or pull requests

8 participants