When I connect with more than one authenticated user in a chatroom my server.js running from the node.js integration module crashes. I would create this ticket under the Node.js module project but I think the problem is with how chatroom handles the code, I'm not entirely sure though.

I run other modules, like tic tac toe, that handle multiple users no problem, so I don't think the error is with server.js, I could be wrong.

root@cloud:/var/www/drupal7/sites/all/modules/contrib/nodejs# node server.js 
Extension loaded: ../tic_tac_toe_for_node_js/nodejs_tic.logic.js
Extension loaded: ../tic_tac_toe_for_node_js/nodejs_tic.server.js
Starting http server.
26 Apr 18:22:43 - socket.io ready - accepting connections
publishMessage: message --> [object Object]
Broadcasting message
26 Apr 18:23:28 - Initializing client with transport "websocket"
26 Apr 18:23:28 - Client 4556544474326074 connected
Authenticating client with key "94971ca0ebb2f0234f83a0b56d49fdfe"
Valid login for uid: 1
adding channels for uid 1: nodejs_user_1,nodejs_ajax_broadcast
publishMessage: message --> [object Object]
Broadcasting message
26 Apr 18:23:38 - Initializing client with transport "xhr-multipart"
26 Apr 18:23:38 - Client 6765123391523957 connected
Authenticating client with key "452c064b724ba88e57bcb39d2d98d2e3"
nodejs_tic: cleanupPlayer 6765123391523957
26 Apr 18:23:40 - Client 6765123391523957 disconnected
Valid login for uid: 3

/var/www/drupal7/sites/all/modules/contrib/nodejs/server.js:458
  socket.clients[sessionId].authKey = authData.authKey;
                                    ^
TypeError: Cannot set property 'authKey' of undefined
    at /var/www/drupal7/sites/all/modules/contrib/nodejs/server.js:458:37
    at IncomingMessage.<anonymous> (/var/www/drupal7/sites/all/modules/contrib/nodejs/server.js:115:9)
    at IncomingMessage.emit (events.js:64:17)
    at HTTPParser.onBody (http.js:121:23)
    at Socket.ondata (http.js:1206:22)
    at Socket._onReadable (net.js:676:27)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

Comments

Anonymous’s picture

Title: Chatroom node.js integration: Auth handling breaking with Node.js Integration module » Auth handling breaking with Node.js Integration module
Project: Chatroom » Node.js integration
Version: 7.x-1.x-dev » 7.x-1.0-alpha6
Assigned: Unassigned »

hmmm. this looks like socket.clients[sessionId] is being unset by one bit of code while another bit of code is trying to set the socket up.

so, i think this belongs in the nodejs.module queue. i'll add some checking to make sure the client socket is still there, and some debug to try to catch this type of event.

thanks for the report.

Anonymous’s picture

ok, committed this so we stop dying:

http://drupalcode.org/project/nodejs.git/commit/0fb52b4

leaving open until we figure out the cause.

LSU_JBob’s picture

This error was created when trying to use the node.js integration module with drupal 7 chatroom

Anonymous’s picture

Assigned: » Unassigned
Anonymous’s picture

can you check if this is still an issue with the latest code?