thiagopradi / octopus

Database Sharding for ActiveRecord
2.53k stars 505 forks source link

idle_in_transaction_session_timeout ActiveRecord::StatementInvalid #466

Open RichardWatkins1 opened 6 years ago

RichardWatkins1 commented 6 years ago

I've recently upgraded my postres version to 9.6 to make use of idle_in_transaction_session_timeout which seems to work. I can generate an idle transaction but running:

ActiveRecord::Base.transaction do
  puts "about to sleep"
  # idle_in_transaction_session_timeout is set to 10 seconds
  sleep(30)
  puts "finished sleeping"
end

this causes FATAL: terminating connection due to idle-in-transaction timeout

But then when I try to connect again with User.count for example I keep getting: ActiveRecord::StatementInvalid: PG::ConnectionBad: PQsocket() can't get socket descriptor

has anyone implemented idle_in_transaction_session_timeout when using octopus before? Is this functionality supported?

Rails version - 5.0.1 Ruby version 2.3.1

niyando commented 3 years ago

@RichardWatkins1 were you able to figure this out?