elastic / elastic/elasticsearch-ruby
Stuck on loop because the number of connections keeps increasing
- Lingua principale
- Ruby
- Stelle
- 2k
- Fork
- 615
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Has anybody had this issue where it continues looping forever because the number of connections keeps increasing?
```
Error -- 3 -- [Faraday::TimeoutError] request timed out {:id=>"kbnoHraTQN6xu2cgbUTeOQ", :name=>"production-master2", :version=>"5.6.16", :host=>"10.0.11.4", :port=>"9200", :roles=>["master"], :attributes=>nil, :protocol=>"http"}
Warning -- 4 -- [Faraday::TimeoutError] Reloading connections (attempt 1 of 14)
Error -- 3 -- [Faraday::TimeoutError] request timed out {:id=>"VYG1SZilTGuIS_FYOSKTRg", :name=>"production-master1", :version=>"5.6.16", :host=>"10.0.10.52", :port=>"9200", :roles=>["master"], :attributes=>nil, :protocol=>"http"}
Warning -- 4 -- [Faraday::TimeoutError] Reloading connections (attempt 2 of 15)
Fatal -- 1 -- [IRB::Abort] abort then interrupt! ({:id=>"Aei_vKRMQJSm2pK3Xphp2Q", :name=>"production-data-ebs1", :version=>"5.6.16", :host=>"10.0.10.49", :port=>"9200", :roles=>["data", "ingest"], :attributes=>nil, :protocol=>"http"})
```
1/14
2/15
3/16
etc
It seems dead connections get somehow duplicated of existing alive ones. I can see essentially the same connection (same host, post, attributes, etc) both in the dead set and alive one (different instances of the connection, not the same).
I've added debug logs to `__rebuild_connections` and this is what I got:
```
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 14
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 15
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 15
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 16
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 16
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 17
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 17
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 18
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 18
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 19
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 19
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 20
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 20
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 21
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 21
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 22
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 22
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 23
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 23
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 24
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 24
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 25
Hosts count: 14
new_connections size: 14
stale_connections size: 0
new_connections (after reject) size: 1
@connections.all size: 25
@connections size: 13
@connections (after) size: 14
@connections.all (after) size: 26
```
If I'm correct, we need to replace
`new_connections = new_connections.reject { |c| @connections.include?(c) }`
with
`new_connections = new_connections.reject { |c| @connections.all.include?(c) }`
_Originally posted by @andrepcg in https://github.com/elastic/elasticsearch-ruby/issues/695#issuecomment-1056898221_
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.