didClose of null traceback #91

Closed
majek opened this Issue Oct 8, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@majek
Member

majek commented Oct 8, 2012

@darklrd pasted a tracback on a mailing list
https://groups.google.com/group/sockjs/msg/9e669b9decfe6a75

Exception on "POST /chat/048/zhsj82kx/xhr_send" in filter "xhr_send":
TypeError: Cannot call method 'didClose' of null
    at Session.close (../node_modules/sockjs/lib/transport.js:226:19)
    at SockJSConnection.close (../node_modules/sockjs/lib/transport.js:58:28)
    at SockJSConnection.end (../node_modules/sockjs/lib/transport.js:53:12)
    at SockJSConnection.sockjs_server.on.socket.on.custom_disconnect (../XXXX.js:YYYY:ZZ)
    at SockJSConnection.EventEmitter.emit (events.js:93:17)
    at Session.didMessage (../node_modules/sockjs/lib/transport.js:207:25)
    at App.exports.app.xhr_send (../node_modules/sockjs/lib/trans-xhr.js:81:15)
    at execute_request (../node_modules/sockjs/lib/webjs.js:21:38)
    at exports.generateHandler.req.next_filter (../node_modules/sockjs/lib/webjs.js:95:18)
    at IncomingMessage.exports.GenericApp.GenericApp.expect_xhr.status (../node_modules/sockjs/lib/webjs.js:272:16)

@darklrd

This comment has been minimized.

Show comment Hide comment
@darklrd

darklrd Oct 8, 2012

Thanks Marek.

darklrd commented Oct 8, 2012

Thanks Marek.

@majek

This comment has been minimized.

Show comment Hide comment
@majek

majek Oct 8, 2012

Member

What happens here is:

  1. we receive data from the stack
  2. you call your custom_disconnect
  3. during the callback you call connection.end() on sockjs
  4. it calls session.close in sockjs code
  5. which runs this code:
      if (this.recv) {
        this.recv.doSendFrame(this.close_frame);
        this.recv.didClose();   <--- this.recv is null

but two lines above it wasn't null. So doSendFrame must have cleared the this.recv, and indeed, that's what happens.

Member

majek commented Oct 8, 2012

What happens here is:

  1. we receive data from the stack
  2. you call your custom_disconnect
  3. during the callback you call connection.end() on sockjs
  4. it calls session.close in sockjs code
  5. which runs this code:
      if (this.recv) {
        this.recv.doSendFrame(this.close_frame);
        this.recv.didClose();   <--- this.recv is null

but two lines above it wasn't null. So doSendFrame must have cleared the this.recv, and indeed, that's what happens.

@darklrd

This comment has been minimized.

Show comment Hide comment
@darklrd

darklrd Oct 8, 2012

I see. Thank you for the explanation. From the name it seems doSendFrame() is trying to send a "close" message to client side.

darklrd commented Oct 8, 2012

I see. Thank you for the explanation. From the name it seems doSendFrame() is trying to send a "close" message to client side.

@majek majek closed this in 81ce634 Oct 8, 2012

majek added a commit that referenced this issue Nov 15, 2012

Fix #91 - in some rare corner cases, for *-streaming closing might h…
…ave triggered null exception

Basically, when the close frame went above the data-per-straming connection limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment