Pita/etherpad-lite — Issue #385: "Cannot read property 'author' of undefined" happening randomly 
Author: scanferla
Created: 2012-01-31 17:41:13+00:00
State: open

Hi,

First of all, thanks for your great work! It's impressive.

My issue:
``` "Cannot read property 'author' of undefined" ```happens randomly when I try to open a pad then Etherpad Lite shuts down.

When I restart it, sometimes this error keeps happening when I try to open a pad... Sometimes it doesn't happen for a day or so but then it strikes again.

This error happens on my Ubuntu localhost and on my Ubuntu Amazon EC2 Instance.

I noticed this began happening when I switched to MySQL. So I tried running it "dirty" again and I didn't get this error anymore. I'm not sure if my tests are 100% accurate.

I also believe but can't be sure that this error has a bigger chance to happen with a specific pad. This pad is the most used and has a big history.

I would guess (I'm no expert) that Etherpad Lite tries to get 'author' out of something that isn't ready yet or something that didn't finish loading...

Here it is:
```
[2012-01-31 17:16:33.213] [INFO] console - Your Etherpad Lite git version is 026e5f5
[2012-01-31 17:16:33.215] [INFO] console - Report bugs at https://github.com/Pita/etherpad-lite/issues
[2012-01-31 17:16:38.371] [INFO] console - Server is listening at 0.0.0.0:9001
[2012-01-31 17:16:38.373] [INFO] console - info - 'socket.io started'
[2012-01-31 17:16:45.718] [INFO] http - 200, GET /p/2709?showControls=true&showChat=false&showLineNumbers=false&useMonospaceFont=false&userName=Gustavo%20Scanferla
[2012-01-31 17:16:45.929] [INFO] http - 304, GET /static/css/pad.css
[2012-01-31 17:16:49.778] [INFO] http - 304, GET /static/custom/pad.css
[2012-01-31 17:16:49.780] [INFO] http - 304, GET /static/custom/pad.js
[2012-01-31 17:17:02.181] [INFO] http - 200, GET /minified/pad.js
[2012-01-31 17:17:02.353] [INFO] http - 304, GET /static/img/etherpad_lite_icons.gif
[2012-01-31 17:17:02.360] [INFO] socket.io - handshake authorized '11941995631483321649'
[2012-01-31 17:17:02.364] [INFO] http - 304, GET /static/img/loading.gif
[2012-01-31 17:17:02.371] [INFO] http - 304, GET /static/img/leftarrow.png
[2012-01-31 17:17:02.735] [INFO] message - from 11941995631483321649: {"component":"pad","type":"CLIENT_READY","padId":"2709","sessionID":null,"password":null,"token":"t.uw8C2uFa9BgfGZjQy6pp","protocolVersion":2}
[2012-01-31 17:17:03.207] [INFO] ueberDB - Flushed 1 values
[2012-01-31 17:17:03.348] [INFO] socket.io - transport end
[2012-01-31 17:17:04.200] [INFO] http - 304, GET /static/css/pad.css
[2012-01-31 17:17:04.215] [INFO] http - 304, GET /minified/pad.js
[2012-01-31 17:17:04.239] [INFO] http - 304, GET /static/custom/pad.css
[2012-01-31 17:17:04.255] [INFO] http - 304, GET /static/custom/pad.js
[2012-01-31 17:17:04.388] [INFO] socket.io - handshake authorized '239587674117304092'
[2012-01-31 17:17:04.398] [INFO] http - 304, GET /static/img/etherpad_lite_icons.gif
[2012-01-31 17:17:04.404] [INFO] http - 304, GET /static/img/leftarrow.png
[2012-01-31 17:17:04.411] [INFO] http - 304, GET /static/img/loading.gif
[2012-01-31 17:17:04.600] [INFO] message - from 239587674117304092: {"component":"pad","type":"CLIENT_READY","padId":"2709","sessionID":null,"password":null,"token":"t.uw8C2uFa9BgfGZjQy6pp","protocolVersion":2}
[2012-01-31 17:17:04.607] [INFO] ueberDB - Flushed 1 values
[2012-01-31 17:17:05.962] [ERROR] console - TypeError: Cannot read property 'author' of undefined
at /home/ubuntu/sites/text/node/handler/PadMessageHandler.js:864:71
at /home/ubuntu/sites/text/node_modules/async/lib/async.js:462:21
at /home/ubuntu/sites/text/node_modules/async/lib/async.js:194:13
at /home/ubuntu/sites/text/node_modules/async/lib/async.js:97:13
at Array.forEach (native)
at /home/ubuntu/sites/text/node_modules/async/lib/async.js:26:24
at /home/ubuntu/sites/text/node_modules/async/lib/async.js:96:9
at /home/ubuntu/sites/text/node_modules/async/lib/async.js:193:9
at Object.map (/home/ubuntu/sites/text/node_modules/async/lib/async.js:177:23)
at Object.parallel (/home/ubuntu/sites/text/node_modules/async/lib/async.js:460:19)
[2012-01-31 17:17:05.962] [INFO] console - graceful shutdown...
```

Thanks in advance!