rethinkdb-ts
rethinkdb-ts copied to clipboard
The connection was closed before the query could be completed in
Hello,
Working fine but after a while I've got "The connection was closed before the query could be completed in" in every request. The only way i've to make it work is to restart the process...
conn = r.connectPool({
silent : true,
waitForHealthy: true,
servers : [{ host : 'server1', port :...},{host : 'server2', port : ...],
buffer : 300,
max : 3000
});
System info
- Debien Bullseye
- RethinkDB Version: 2.42
Additional context 1x cluster of 2 servers
Is there a link with the connectPool ? Any idea ?
connection pool seems to be buggy. can't reproduce the bug and have no time and resources to do smth with that. We have fixed that with creating a proxy server of a rethinkdb, to which the client connects (proxy handles the pooling of connections)
if I can help in any way please say. I can give you access to the server with this problem. The problem is really happening every 30 minutes. It's regular.
I'm logging 'queueing' 'size' 'available-size' in my script. And this is what I see. After a while there is no more event on
"available-size" and "size"
Looks like it's stuck
pool size 654
pool available-size 648
pool queueing 12
pool queueing 12 is the number of changes() listeners. Seems correct.
This is my pool configuration:
buffer : 300,
max : 1000
And this is the log just before it crashs
I received the events "available-size" and "size" when I had not received it for a while
pool queueing 12
pool size 657
pool available-size 652
public table feedChange error FeedChange #0 from event The connection was closed before the query could be completed in:
By the way, I never receive the "error" event on the pool. This error came from here:
this.r.db(this.db).table(this.table, {readMode: 'outdated'}).changes({
includeTypes :true
}).run().then(function(cursor){
cursor.each(function(e, item){
if(e){
=====> e
}
})
})
After that, nothing to do. Just restart the process.
I am not quite sure how to fix that but to start rewriting the whole codebase with keeping some of the logic already done. My suggestion is some things are done wrong in rethinkdbdash from which this project has started, which keeps other stuff being buggy. And because for now other things are working well for my company- I don't spend a time on it. You might wanna try the 3.x alpha version of this library, though mostly I have just fixed some coupling problems from modules perspective
I think it's an issue with buffer and max
I put back rethinkdbdash and available-size looks more correct:
rethinkdbdash:
available-size 305
(I don't have "size" event on rethinkddash", don't know why...)
rethinkdb-ts:
pool size 657
pool available-size 652
Both of them with those options:
buffer: 300 - Minimum number of connections available in the pool, default 50
max: 1000 - Maximum number of connections available in the pool, default 1000
With rethinkdb-ts apparently it opens 2x more connections ?
Connections pool looks more stable on rethinkdbdash