neumino / thinky

JavaScript ORM for RethinkDB
http://justonepixel.com/thinky/
Other
1.12k stars 128 forks source link

Unhandled rejection ReqlRuntimeError #605

Closed DerEnderKeks closed 7 years ago

DerEnderKeks commented 7 years ago

Hello,

I'm currently trying to dockerize Yanius but there somehow is a problem with the rethink stuff.

It always throws an exception during startup and I have no idea why and where it comes from as the node stacktrace is quite useless... If I start it in my normal environment everything works just fine (same node, rethink and npm module versions).

Can anyone tell me where that ReqlRuntimeError comes from and maybe how to fix it? Sourcecode is available in the previously mentioned repository. (It's a mess. I know.)

web_1  | > Yanius@2.1.1 start /usr/src/app
web_1  | > node --harmony ./bin/www
web_1  | 
web_1  | Creating a pool connected to db:28015
web_1  | Unhandled rejection ReqlRuntimeError
web_1  |     at Connection._processResponse (/usr/src/app/node_modules/rethinkdbdash/lib/connection.js:395:15)
web_1  |     at Socket.<anonymous> (/usr/src/app/node_modules/rethinkdbdash/lib/connection.js:201:14)
web_1  |     at emitOne (events.js:96:13)
web_1  |     at Socket.emit (events.js:189:7)
web_1  |     at readableAddChunk (_stream_readable.js:176:18)
web_1  |     at TCP.onread (net.js:551:20)
web_1  |     at Function.module.exports.loopWhile (/usr/src/app/node_modules/deasync/index.js:72:22)
web_1  |     at module.exports (/usr/src/app/util/setup.js:100:11)
web_1  |     at Object.<anonymous> (/usr/src/app/app.js:38:56)
web_1  |     at Module._compile (module.js:571:32)
web_1  |     at Object.Module._extensions..js (module.js:580:10)
web_1  |     at Module.load (module.js:488:32)
web_1  |     at tryModuleLoad (module.js:447:12)
web_1  |     at Function.Module._load (module.js:439:3)
web_1  |     at require (internal/module.js:20:19)
web_1  |     at Object.<anonymous> (/usr/src/app/bin/www:8:13)
web_1  |     at Module._compile (module.js:571:32)
web_1  |     at Object.Module._extensions..js (module.js:580:10)
web_1  |     at Module.load (module.js:488:32)
web_1  |     at tryModuleLoad (module.js:447:12)
web_1  |     at Function.Module._load (module.js:439:3)
web_1  |     at Module.runMain (module.js:605:10)
neumino commented 7 years ago

What version of thinky/rethinkdbdash are you using here?

DerEnderKeks commented 7 years ago
+-- thinky@2.3.8
| +-- rethinkdbdash@2.3.27
mmahalwy commented 7 years ago

I have the same problem. It's a HUGE pain to find where the source is...

mrsum commented 7 years ago

Same problem

neumino commented 7 years ago

Can you provide a script that reproduce this error?

DerEnderKeks commented 7 years ago

I can't because I don't know what exactly causes this exception and where it's caused. The line number in the stacktrace leads to this:

  deasync.loopWhile(() => { // this line
    return !configSaved; 
  });

And this line is not doing anything with thinky directly but it waits for the result of the query above it.

neumino commented 7 years ago

If you look at the code in rethinkdbdash, it's an error returned by RethinkDB. Can you just print the error there? There error should come with a backtrace of what query failed.

DerEnderKeks commented 7 years ago

Where exactly is this error message supposed to be? The stacktrace I posted above is everything it logs.

neumino commented 7 years ago

/usr/src/app/node_modules/rethinkdbdash/lib/connection.js line 395

Steinweber commented 7 years ago

I get the same error after some IDLE time

DerEnderKeks commented 7 years ago

alright, after finding out that I forgot to add an error handler in one of my database functions I now got the exact error message:

msg: 'Cannot perform read: primary replica for shard ["", +inf) not available',
message: 'Cannot perform read: primary replica for shard ["", +inf) not available in:\nr.table("config").delete()\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n',
frames: [],
name: 'ReqlOpFailedError'