Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Special jxcore timer don't want to work with big numbers #74

Open
andrew-aladev opened this issue Nov 21, 2016 · 2 comments
Open

Special jxcore timer don't want to work with big numbers #74

andrew-aladev opened this issue Nov 21, 2016 · 2 comments
Assignees

Comments

@andrew-aladev
Copy link

andrew-aladev commented Nov 21, 2016

We've received a bug from lib/jx/_jx_timers.js. We can use 9 year timeout but we couldn't increase it to 10 years.

'use strict';

var net = require('net');
var TIMEOUT = 1000 * 60 * 60 * 24 * 365 * 10;

var server = net.createServer();
server.listen(0, function () {
  var socket = new net.Socket();
  var start  = new Date();
  socket.setTimeout(TIMEOUT, function () {
    console.log('time: %d', new Date() - start);
  });
  socket.connect(server.address().port);
});

We will receive time: 5001 with jxcore, but we won't receive anything with usual node. We can decrease the TIMEOUT to be 1000 * 60 * 60 * 24 * 365 * 9 and all will work as expected.

@enricogior
Copy link
Member

enricogior commented Nov 21, 2016

I don't think that using 9 years works, it's just a different overflow compared to 10 years so it doesn't expire after 5 seconds like in the case of 10 years, the max value it's 28 days.
The fix in jxcore should be to return an error if the timeout value is greater than 2,147,483,647 or default to 2,147,483,647.

@yaronyg
Copy link
Member

yaronyg commented Nov 21, 2016

We need to do whatever node does.

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

3 participants