mauritslamers / Thoth

A Node-based communications hub for multi-user SproutCore applications, serving as a unified database interface and automating distribution of data changes
http://devmt.hku.nl/~maurits/doku.php?id=thoth:start
43 stars 4 forks source link

auth causes crash in Memstore #5

Closed ralfschimmel closed 12 years ago

ralfschimmel commented 12 years ago

Browser console shows: Sending message of type auth and with data: {user: test , passwd: test , application: Bw}

Server shows:

/home/node/staging/Thoth/lib/core/MemStore.js:56 if(!this._tables[bucket]) this._tables[bucket] = {}; // create bucket if i ^ TypeError: Cannot read property 'test' of undefined at [object Object]. (/home/node/staging/Thoth/lib/core/MemStore.js:56:21) at [object Object].createDBRecord (/home/node/staging/Thoth/lib/core/DiskStore.js:59:27) at [object Object].createRecord (/home/node/staging/Thoth/lib/core/Store.js:306:12) at [object Object].createSessionObject (/home/node/staging/Thoth/lib/core/Session.js:188:16) at [object Object].createSession (/home/node/staging/Thoth/lib/core/Session.js:238:10) at /home/node/staging/Thoth/lib/core/SocketIO.js:76:57 at [object Object].checkAuth (/home/node/staging/Thoth/lib/FileAuth.js:61:6) at Socket. (/home/node/staging/Thoth/lib/core/SocketIO.js:66:19) at Socket.$emit (events.js:64:17) at SocketNamespace.handlePacket (/home/node/.node_libraries/.npm/socket.io/0.8.4/package/lib/namespace.js:331:20)

mauritslamers commented 12 years ago

Analysis of this message shows that the probable cause of this is the DiskStore loading an empty file, and then overwriting the private _tables and _counters properties with undefined values. Otherwise the properties should have been either null or an empty object. Fixed on master.

ralfschimmel commented 12 years ago

Indeed fixed!