Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Crash in timers.js on master "Cannot set property '_idlePrev' of null" #481

Closed
BonsaiDen opened this issue Nov 30, 2010 · 7 comments
Closed

Comments

@BonsaiDen
Copy link

That's what I get as soon as I write to a socket:
https://github.com/BonsaiDen/NodeGame-Orbit/blob/master/server/libs/socket.js#L277

timers.js:15011
      item._idleNext._idlePrev = item._idlePrev;
                               ^
TypeError: Cannot set property '_idlePrev' of null
    at Object.active (timers.js:150:32)
    at Stream._writeOut (net.js:370:21)
    at Stream.write (net.js:295:17)
    at Object.establish (/home/ivo/Desktop/NodeGame-Orbit/server/libs/socket.js:277:29)
    at Object.WebSocket (/home/ivo/Desktop/NodeGame-Orbit/server/libs/socket.js:135:14)
    at Server.<anonymous> (/home/ivo/Desktop/NodeGame-Orbit/server/libs/socket.js:40:48)
    at Server.emit (events.js:48:20)
    at Stream.<anonymous> (http.js:807:14)
    at Stream._onReadable (net.js:566:27)
    at IOWatcher.onReadable [as callback] (net.js:151:10)
@ry
Copy link

ry commented Nov 30, 2010

which version of node?

@BonsaiDen
Copy link
Author

3.2 checked out master about two hours ago.

@TooTallNate
Copy link

Ya I encountered this last night too. I think it was caused by one of the mingw commits.

@ry
Copy link

ry commented Dec 1, 2010

it's probably caused by 645c3b3

i would love a test if you can isolate it.

@gcr
Copy link

gcr commented Dec 1, 2010

sorry, pretty sure this was my fault. Don't let gcr mess with the timers again.

When you write to a socket, it calls 'active' on it. active notices that it was previously removed (perhaps it timed out or something) and just does an 'inline append' which relinks the timer. My change garbaged that data though; that's where this failed.

I can't get your specific test built but here's a stupid test that shows the issue in my commit.
https://gist.github.com/723000
probably not appropriate to include in mainline though

Try it on:
gcr/node@540b3e8

(ry, should I make another pull request?)

@BonsaiDen
Copy link
Author

Testcase:

var http = require('http');
var srv = new http.Server();
srv.addListener('connection', function(socket) {
    socket.setTimeout(0); // 0 makes it crash immediately when writing
    socket.write('HTTP/1.1 200\r\n', 'ascii');
    socket.flush();
    process.exit();
});
srv.listen(4444);

setTimeout(function() {
var c = http.createClient(4444, '127.0.0.1');
    c.request('GET', '/', {'host': 'localhost'}); 
}, 50);

Crashes with current master, works with gcr/node@540b3e8

@ry
Copy link

ry commented Dec 1, 2010

gcr fixed this in 5f3464c. beautiful test case.

This issue was closed.
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

4 participants