Opened 9 years ago

Closed 9 years ago

#2869 closed defect (invalid)

"Connection refused - connect(2)" error when running `rake db:migrate'. Stops on CreateCountries

Reported by: avar Owned by: Tom Hughes
Priority: major Milestone:
Component: website Version:
Keywords: Cc:

Description

A script I've been running to setup a fresh rails port every day started failing after upgrading to r20861:

createuser osmistmp -w -S -D -R
createdb -E UTF8 -O osmistmp osmistmp
echo "alter user osmistmp encrypted password 'osmistmp';" | psql osmistmp

Then I set up my database settings:

echo "development:"           > config/database.yml
echo "  adapter: postgresql" >> config/database.yml
echo "  database: osmistmp"  >> config/database.yml
echo "  username: osmistmp"  >> config/database.yml
echo "  password: osmistmp"  >> config/database.yml
echo "  host: localhost"     >> config/database.yml
echo "  encoding: utf8"      >> config/database.yml

And finally migrate:

rake --trace db:migrate

This creates a partial schema:

                    List of relations
 Schema |           Name           |   Type   |  Owner   
--------+--------------------------+----------+----------
 public | acls                     | table    | osmistmp
 public | acls_id_seq              | sequence | osmistmp
 public | changeset_tags           | table    | osmistmp
 public | changesets               | table    | osmistmp
 public | changesets_id_seq        | sequence | osmistmp
....

But it fails partway through on CreateCountries?:

==  AddForeignKeys: migrating =================================================
-- add_foreign_key(:changeset_tags, [:id], :changesets)
   -> 0.0017s
-- add_foreign_key(:diary_comments, [:diary_entry_id], :diary_entries, [:id])
   -> 0.0016s
-- add_foreign_key(:gps_points, [:gpx_id], :gpx_files, [:id])
   -> 0.0388s
-- add_foreign_key(:gpx_file_tags, [:gpx_id], :gpx_files, [:id])
   -> 0.0016s
==  AddForeignKeys: migrated (0.0443s) ========================================

==  CreateCountries: migrating ================================================
-- innodb_table()
   -> 0.0001s
-- create_table(:countries, {:force=>true, :options=>"", :id=>false})
NOTICE:  CREATE TABLE will create implicit sequence "countries_id_seq" for serial column "countries.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "countries_pkey" for table "countries"
   -> 0.0074s
-- add_index(:countries, [:code], {:unique=>true, :name=>"countries_code_idx"})
   -> 0.0013s
rake aborted!
An error has occurred, this and all later migrations canceled:

Connection refused - connect(2)   

/usr/lib/ruby/1.8/net/http.rb:560:in `initialize'
/usr/lib/ruby/1.8/net/http.rb:560:in `open'
/usr/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
/usr/lib/ruby/1.8/timeout.rb:93:in `timeout'
/usr/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
/usr/lib/ruby/1.8/net/http.rb:542:in `start'
/usr/lib/ruby/1.8/net/http.rb:440:in `start'
./db/migrate//031_create_countries.rb:17:in `up_without_benchmarks'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:282:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:282:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:282:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:365:in `__send__'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:365:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:486
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:560:in `call'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:560:in `ddl_transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:182:in `transaction_without_deadlock_handling'
/home/avar/src/osm.nix.is/osm-sites-rails_port/vendor/plugins/deadlock_retry/lib/deadlock_retry.rb:46:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:560:in `ddl_transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:485:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:472:in `each'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:472:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `up'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:in `migrate'
/var/lib/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:116

/usr/lib/ruby/1.8/rake.rb:636:in `call'
/usr/lib/ruby/1.8/rake.rb:636:in `execute'
/usr/lib/ruby/1.8/rake.rb:631:in `each'
/usr/lib/ruby/1.8/rake.rb:631:in `execute'
/usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:583:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2029:in `each'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2023:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2001:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'

Change History (1)

comment:1 Changed 9 years ago by Tom Hughes

Resolution: invalid
Status: newclosed

This isn't a bug in our code, and is nothing to do with your update. The problem is simply that the migration that is failing tries to fetch a list of countries from geonames.org to populate a database table, and geonames has been having trouble over the last few days.

Note: See TracTickets for help on using tickets.