wachunga / omega

Real-time issue tracker optimized for small teams
http://omegatracker.herokuapp.com
MIT License
114 stars 26 forks source link

OmegaEvent has no method 'slice' and 'push' #2

Closed russellporter closed 12 years ago

russellporter commented 12 years ago

Here's a crash I just encountered running the current omega code:

   info  - transport end
   debug - cleared close timeout for client 776232242829913784
   debug - discarding transport
   debug - setting request GET /socket.io/1/xhr-polling/776232242829913784?t=1321083897421
   debug - setting poll timeout
   debug - clearing poll timeout
   debug - xhr-polling writing 7:::1+0
   debug - set close timeout for client 776232242829913784
   warn  - client not handshaken client should reconnect
   info  - transport end
   debug - cleared close timeout for client 776232242829913784
   debug - discarding transport
   debug - setting request GET /socket.io/1/xhr-polling/17654711111631277475?t=1321083897432

/home/rporter/Omega-Issue-Tracker/server.js:44
    socket.emit('history', history.slice(-HISTORY_ITEMS_TO_SHOW));
                                ^
TypeError: Object #<OmegaEvent> has no method 'slice'
    at SocketNamespace.<anonymous> (/home/rporter/Omega-Issue-Tracker/server.js:44:33)
    at SocketNamespace.$emit (events.js:64:17)
    at connect (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/namespace.js:291:10)
    at /home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/namespace.js:308:13
    at SocketNamespace.authorize (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/namespace.js:252:5)
    at SocketNamespace.handlePacket (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/namespace.js:302:14)
    at Manager.handleClient (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/manager.js:634:30)
    at Manager.handleHTTPRequest (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/manager.js:575:8)
    at Manager.handleRequest (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/manager.js:537:12)
    at Server.<anonymous> (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/manager.js:96:10)

Another crasher, probably related..

   debug - set close timeout for client 1286718887610965918
   debug - xhr-polling closed due to exceeded duration
   debug - clearing poll timeout
   debug - xhr-polling writing 8::
   debug - set close timeout for client 16529574812006731533
   debug - xhr-polling closed due to exceeded duration
   debug - setting request GET /socket.io/1/xhr-polling/1286718887610965918?t=1321148927185
   debug - setting poll timeout
   debug - discarding transport
   debug - cleared close timeout for client 1286718887610965918
   debug - setting request GET /socket.io/1/xhr-polling/16529574812006731533?t=1321148932331
   debug - setting poll timeout
   debug - discarding transport
   debug - cleared close timeout for client 16529574812006731533
   debug - xhr-polling received data packet 5:::{"name":"user message","args":["hmm"]}

/home/rporter/Omega-Issue-Tracker/server.js:133
        history.push(event);
          ^
TypeError: Object #<OmegaEvent> has no method 'push'
    at recordEvent (/home/rporter/Omega-Issue-Tracker/server.js:133:11)
    at Socket.<anonymous> (/home/rporter/Omega-Issue-Tracker/server.js:60:15)
    at Socket.$emit (events.js:64:17)
    at SocketNamespace.handlePacket (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/namespace.js:331:20)
    at Manager.onClientMessage (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/manager.js:436:38)
    at XHRPolling.onMessage (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transport.js:387:20)
    at XHRPolling.onData (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transports/http.js:89:10)
    at IncomingMessage.<anonymous> (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transports/http.js:60:12)
    at IncomingMessage.emit (events.js:61:17)
    at HTTPParser.onMessageComplete (http.js:133:23)
wachunga commented 12 years ago

How did history become something other than an array... weird. Any steps to reproduce?

russellporter commented 12 years ago

Just happened again

   debug - xhr-polling writing 5:::{"name":"user message","args":[{"type":{"name":"userMessage","message":"<%= message %>","notificationTitle":"<%= speaker %> says...","notificationBody":"<%= message %>"},"speaker":"thomas","message":"k","notification":{"title":"thomas says...","body":"k"}}]}
   debug - set close timeout for client 725375002653685103
   debug - clearing poll timeout
   debug - xhr-polling writing 5:::{"name":"user message","args":[{"type":{"name":"userMessage","message":"<%= message %>","notificationTitle":"<%= speaker %> says...","notificationBody":"<%= message %>"},"speaker":"thomas","message":"k","notification":{"title":"thomas says...","body":"k"}}]}
   debug - set close timeout for client 19233597452005223501
   debug - setting request GET /socket.io/1/xhr-polling/19233597452005223501?t=1321328179988
   debug - setting poll timeout
   debug - discarding transport
   debug - cleared close timeout for client 19233597452005223501
   debug - setting request GET /socket.io/1/xhr-polling/725375002653685103?t=1321328184047
   debug - setting poll timeout
   debug - discarding transport
   debug - cleared close timeout for client 725375002653685103
   debug - xhr-polling received data packet 5:::{"name":"user message","args":["i am keeping the current password hash"]}

/home/rporter/Omega-Issue-Tracker/server.js:133
        history.push(event);
          ^
TypeError: Object #<OmegaEvent> has no method 'push'
    at recordEvent (/home/rporter/Omega-Issue-Tracker/server.js:133:11)
    at Socket.<anonymous> (/home/rporter/Omega-Issue-Tracker/server.js:60:15)
    at Socket.$emit (events.js:64:17)
    at SocketNamespace.handlePacket (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/namespace.js:331:20)
    at Manager.onClientMessage (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/manager.js:436:38)
    at XHRPolling.onMessage (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transport.js:387:20)
    at XHRPolling.onData (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transports/http.js:89:10)
    at IncomingMessage.<anonymous> (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transports/http.js:60:12)
    at IncomingMessage.emit (events.js:61:17)
    at HTTPParser.onMessageComplete (http.js:133:23)
russellporter commented 12 years ago

we are trying to reproduce but cant. we tried hammering the chatroom to see if it was a concurrency issue, but doesn't seem like it. aaand.. it just happened again:

   debug - setting poll timeout
   debug - discarding transport
   debug - cleared close timeout for client 3061181621422586151

   debug - xhr-polling received data packet 5:::{"name":"user message","args":["when you are including the css <link rel=\"stylesheet\" type=\"text/css\" href=\"/css/blueprint/screen.css\" media=\"screen, projection\" />"]}
/home/rporter/Omega-Issue-Tracker/server.js:133
        history.push(event);
          ^
TypeError: Object #<OmegaEvent> has no method 'push'
    at recordEvent (/home/rporter/Omega-Issue-Tracker/server.js:133:11)
    at Socket.<anonymous> (/home/rporter/Omega-Issue-Tracker/server.js:60:15)
    at Socket.$emit (events.js:64:17)
    at SocketNamespace.handlePacket (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/namespace.js:331:20)
    at Manager.onClientMessage (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/manager.js:436:38)
    at XHRPolling.onMessage (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transport.js:387:20)
    at XHRPolling.onData (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transports/http.js:89:10)
    at IncomingMessage.<anonymous> (/home/rporter/Omega-Issue-Tracker/node_modules/socket.io/lib/transports/http.js:60:12)
    at IncomingMessage.emit (events.js:61:17)
    at HTTPParser.onMessageComplete (http.js:133:23)
russellporter commented 12 years ago

Could this be a chrome with notifications bug? I am the only one using chrome with notifications i think.

Also I am pretty sure this is chat related, it always happens when i am posting a message.

I have also updated the server with the require.js changes, but it still happens. All i can do to reproduce is type lots of chat messages in for a few minutes, with someone else typing occasionally as well.

russellporter commented 12 years ago

Update: Underscore is returning the last object in history rather than the last 10 in an array.

It seems like a race condition, I can't reproduce in an underscore test. All I know for sure is using slice instead of last fixes the problem.

wachunga commented 12 years ago

Bah, should have thought of this earlier. You must be using pre 1.2.0 underscore on the server side. Try npm update underscore...