patrikx3/redis-ui

unreproducible: uncaughtException TypeError: Cannot read property 'command' of undefined

p3x-robot opened this issue · 1 comments

ay 10 10:53:37 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:37.176 [INFO]   [PID: 021488] socket.io connected FSp2v7Zjv9VyxbazAAGM
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.985 [WARN]   [PID: 021488] shared disconnectRedisIo try
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.986 [INFO]   [PID: 021488] socket.io connection-connect added new socket.id FSp2v7Zjv9VyxbazAAGM to P3Xid7e893a8c561010008cc0b0e71a398b name with localhost test
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.986 [INFO]   [PID: 021488] socket.io connection-connect P3Xid7e893a8c561010008cc0b0e71a398b localhost test connected
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.990 [WARN]   [PID: 021488] socket.io getStreamKeys dbsize 23 count 100
May 10 10:54:14 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:14.822 [WARN]   [PID: 021488] socket.io getStreamKeys dbsize 10000 count 100
May 10 10:54:15 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:15.937 [WARN]   [PID: 021488] socket.io getStreamKeys dbsize 10000 count 100
May 10 10:54:27 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:27.046 [ERROR]  [PID: 021488] { ReplyError: ERR unknown command `ls`, with args beginning with:
May 10 10:54:27 server p3xrs.js[21488]:     at parseError (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:179:12)
May 10 10:54:27 server p3xrs.js[21488]:     at parseType (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:302:14) command: { name: 'ls', args: [] } }
May 10 10:54:55 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:55.249 [ERROR]  [PID: 021488] { ReplyError: ERR unknown command `ll`, with args beginning with:
May 10 10:54:55 server p3xrs.js[21488]:     at parseError (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:179:12)
May 10 10:54:55 server p3xrs.js[21488]:     at parseType (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:302:14) command: { name: 'll', args: [] } }
May 10 10:55:01 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:55:01.177 [ERROR]  [PID: 021488] 5/10/2019, 10:55:01 AM uncaughtException TypeError: Cannot read property 'command' of undefined
May 10 10:46:17 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:46:17.356 [INFO]   [PID: 021488] socket.io disconnected 0I2fAv9nTdiiOkvJAAGL
May 10 10:53:37 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:37.176 [INFO]   [PID: 021488] socket.io connected FSp2v7Zjv9VyxbazAAGM
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.985 [WARN]   [PID: 021488] shared disconnectRedisIo try
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.986 [INFO]   [PID: 021488] socket.io connection-connect added new socket.id FSp2v7Zjv9VyxbazAAGM to P3Xid7e893a8c561010008cc0b0e71a398b name with localhost test
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.986 [INFO]   [PID: 021488] socket.io connection-connect P3Xid7e893a8c561010008cc0b0e71a398b localhost test connected
May 10 10:53:43 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:53:43.990 [WARN]   [PID: 021488] socket.io getStreamKeys dbsize 23 count 100
May 10 10:54:14 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:14.822 [WARN]   [PID: 021488] socket.io getStreamKeys dbsize 10000 count 100
May 10 10:54:15 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:15.937 [WARN]   [PID: 021488] socket.io getStreamKeys dbsize 10000 count 100
May 10 10:54:27 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:27.046 [ERROR]  [PID: 021488] { ReplyError: ERR unknown command `ls`, with args beginning with:
May 10 10:54:27 server p3xrs.js[21488]:     at parseError (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:179:12)
May 10 10:54:27 server p3xrs.js[21488]:     at parseType (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:302:14) command: { name: 'ls', args: [] } }
May 10 10:54:55 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:54:55.249 [ERROR]  [PID: 021488] { ReplyError: ERR unknown command `ll`, with args beginning with:
May 10 10:54:55 server p3xrs.js[21488]:     at parseError (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:179:12)
May 10 10:54:55 server p3xrs.js[21488]:     at parseType (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:302:14) command: { name: 'll', args: [] } }
May 10 10:55:01 server p3xrs.js[21488]: [P3XRS] 2019/05/10 10:55:01.177 [ERROR]  [PID: 021488] 5/10/2019, 10:55:01 AM uncaughtException TypeError: Cannot read property 'command' of undefined
May 10 10:55:01 server p3xrs.js[21488]:     at Redis.exports.returnError (/var/p3x-redis-ui-server/node_modules/ioredis/built/redis/parser.js:36:20)
May 10 10:55:01 server p3xrs.js[21488]:     at JavascriptRedisParser.returnError (/var/p3x-redis-ui-server/node_modules/ioredis/built/redis/parser.js:20:19)
May 10 10:55:01 server p3xrs.js[21488]:     at JavascriptRedisParser.execute (/var/p3x-redis-ui-server/node_modules/redis-parser/lib/parser.js:542:14)
May 10 10:55:01 server p3xrs.js[21488]:     at Socket.<anonymous> (/var/p3x-redis-ui-server/node_modules/ioredis/built/redis/event_handler.js:107:26)
May 10 10:55:01 server p3xrs.js[21488]:     at Socket.emit (events.js:193:13)
May 10 10:55:01 server p3xrs.js[21488]:     at addChunk (_stream_readable.js:295:12)
May 10 10:55:01 server p3xrs.js[21488]:     at readableAddChunk (_stream_readable.js:276:11)
May 10 10:55:01 server p3xrs.js[21488]:     at Socket.Readable.push (_stream_readable.js:231:10)
May 10 10:55:01 server p3xrs.js[21488]:     at TCP.onStreamRead (internal/stream_base_commons.js:150:17)
May 10 10:55:01 server systemd[1]: p3x-redis-ui-example.service: Main process exited, code=exited, status=1/FAILURE
May 10 10:55:01 server systemd[1]: p3x-redis-ui-example.service: Failed with result 'exit-code'.

solved by checking on the main command if it includes with command array and seems to be good.

        if (!socket.p3xrs.commands.includes(mainCommand)) {
            throw new Error(`UNKNOWN COMMAND: ${mainCommand}`)
        }