Skip to content

PG::ConnectionBad: connection to server at "::1", when upgrading from 1.2.3 -> 1.3.1 #452

@jsnwesson

Description

@jsnwesson

An issue that we've come across when upgrading from 1.2.3 to 1.3.1 is that for some people in my team, when trying to query into the production database (that we tunnel into), they receive this error:

ActiveRecord::ConnectionNotEstablished: connection to server at "::1", port 9456 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?

from /Users/jason/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4.4/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client'
Caused by PG::ConnectionBad: connection to server at "::1", port 9456 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?

from /Users/jason/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/pg-1.3.1/lib/pg/connection.rb:637:in `async_connect_or_reset'

We found that there's a potential threading issue that occurs here, as we've been able to resolve the BadConnection error by adding a simple puts immediately after this line.

Is this an issue that you all have possibly seen before?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions