Closed seamusabshere closed 5 years ago
in the meantime I am going to try to fix this with:
sess_pool = @bigquery.service.service.client.instance_variable_get(:@session_manager).instance_variable_get(:@sess_pool)
sess_pool.each do |_, sessions|
sessions.each do |session|
begin
session.close
rescue ::Errno::EPIPE
$stderr.puts "Couldn't close a socket, probably killed by AWS NAT, oh well"
end
end
end
sess_pool.clear
OK, no interest, closing!
We use https://github.com/googleapis/google-cloud-ruby to connect to BigQuery from AWS. We have an AWS NAT in place that kills idle connections after 5 minutes. When the previous code tried to clean up old sessions, it would fail with
Broken pipe
onsess.close
... and the invalid sessions would remain in the cache (becausepool.replace
was never called).So rescuing from
HTTPClient::KeepAliveDisconnected
to retry it would immediately fail again, because it would use the invalid session that wasn't removed.