Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG::ConnectionBad on activejob(resque adapter) after upgrading to rails 5.2.0.beta2 #31766

Closed
bituinb opened this issue Jan 23, 2018 · 4 comments
Assignees
Milestone

Comments

@bituinb
Copy link

bituinb commented Jan 23, 2018

Steps to reproduce

Expected behavior

Tell us what should happen
All jobs fails with PG::ConnectionBad exception

Actual behavior

Job fails with exception :
PG::ConnectionBad (connection is closed)

System configuration

Rails version: Rails 5.2.0.beta2
Ruby version: ruby 2.4.3p205
Pg gem version: pg-0.21.0
Resque config: 'config/resque.rb'

require "redis"
Resque.before_fork = Proc.new do |job|
ActiveRecord::Base.connection.disconnect!
end

Resque.after_fork = Proc.new do |job|
ActiveRecord::Base.establish_connection
end

@bituinb bituinb changed the title PG::ConnectionBad on activejob(resque adapter) after upgrading to rails Rails 5.2.0.beta2 PG::ConnectionBad on activejob(resque adapter) after upgrading to rails 5.2.0.beta2 Jan 23, 2018
@matthewd
Copy link
Member

Thanks for the report!

Could you create a new demo application that shows the problem?

@matthewd matthewd self-assigned this Jan 23, 2018
@matthewd matthewd added this to the 5.2.0 milestone Jan 23, 2018
@bituinb
Copy link
Author

bituinb commented Jan 23, 2018

Please see demo application

https://github.com/bituinb/xyz

My local dev is using Postgres 9.5.2 and mac OSX 10.9.5

Instruction is in readme

Thank you

@matthewd
Copy link
Member

Perfect, thank you. ❤️

This was a bug in #31173; fixed in 1280ad6.

FYI, you don't actually need those before/after fork blocks any more -- that's what that PR does -- but they certainly shouldn't break your application 😅, so this was a good catch.

@bituinb
Copy link
Author

bituinb commented Feb 1, 2018

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants