Rethinkdb连接导致oob错误

时间:2016-04-13 02:30:24

标签: node.js rethinkdb

我正在使用rethinkdb和nodejs但是当我尝试运行基本示例时,它会导致oob错误。我正在运行Ubuntu 14.04并通过运行rethinkdb命令运行rethinkdb服务器。

Rethinkdb命令输出:

$ rethinkdb
Recursively removing directory /home/tom/rethinkdb_data/tmp
Initializing directory /home/tom/rethinkdb_data
Running rethinkdb 2.3.0~0trusty (GCC 4.8.2)...
Running on Linux 3.16.0-67-generic x86_64
Loading data from directory /home/tom/rethinkdb_data
Listening for intracluster connections on port 29015
Listening for client driver connections on port 28015
Listening for administrative HTTP connections on port 8080
Listening on cluster addresses: 127.0.0.1, 127.0.1.1, ::1
Listening on driver addresses: 127.0.0.1, 127.0.1.1, ::1
Listening on http addresses: 127.0.0.1, 127.0.1.1, ::1
To fully expose RethinkDB on the network, bind to all addresses by running rethinkdb with the `--bind all` command line option.
Server ready, "toms_pc_s4j" 643029e6-a2c3-4abb-b826-64d28310bd36

以下是代码:

r = require('rethinkdb')
r.connect({ host: 'localhost', port: 28015 }, function(err, conn) {
  if(err) throw err;
}

导致以下错误:

buffer.js:559
  if (start > end) throw new Error('oob');
                         ^
    Error: oob
        at Buffer.slice (buffer.js:559:26)
        at Socket.TcpConnection.rawSocket.once.handshake_callback (/home/tom/Downloads/rethink/node_modules/rethinkdb/net.js:692:46)
        at Socket.EventEmitter.emit (events.js:96:17)
        at TCP.onread (net.js:397:14)

请帮忙。谢谢。

1 个答案:

答案 0 :(得分:0)

我遇到了一个(有点)类似的问题,运行Debian:

Creating a pool connected to 127.0.0.1:28015
Setting up listener...
buffer.js:247
  throw new TypeError(kFromErrorMsg);
  ^

TypeError: must start with number, buffer, array or string
    at fromObject (buffer.js:247:9)
    at Function.Buffer.from (buffer.js:115:10)
    at new Buffer (buffer.js:94:17)
    at Socket.<anonymous> (/home/samuel/Code/app/node_modules/rethinkdbdash/lib/connection.js:113:22)
    at emitNone (events.js:85:20)
    at Socket.emit (events.js:179:7)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1046:10)

在尝试了不同的rethinkdb版本(独立服务器和package.json-dependency)之后,尝试了不同版本的npm和节点等,我完全安装了Ubuntu ......但问题仍然存在。

我的代码:

function connect() {
  return r.connect(config.get('rethinkdb'));
}

export function liveUpdates(io) {
  console.log('Setting up listener...');
  connect()
  .then(conn => {
    r
    .table('tickets')
    .changes().run(conn, (err, cursor) => {
      console.log('Listening for changes...');
      cursor.each((err, change) => {
        console.log('Change detected', change);
        io.emit('ticket-change', change);
      });
    });
  });
}

npm -v

3.8.3

node -v

v5.10.1

rethinkdb --version

rethinkdb 2.3.0~0wily(GCC 5.2.1)