2012-02-13 8 views
7

Ok, tengo una aplicación de rieles que estoy tratando de ejecutar las migraciones en un db postgres y generalmente uso mysql y todo está bien, pero cuando ejecuto el comando obtengo estorake db: migrar no funciona en mi postgres db

rake db:migrate 
(in /Users/tamer/Sites/my_app) 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:487: [BUG] Segmentation fault 
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0] 

-- control frame ---------- 
c:0058 p:---- s:0215 b:0215 l:000214 d:000214 CFUNC :exec 
c:0057 p:0040 s:0211 b:0211 l:000191 d:000210 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0056 p:0005 s:0208 b:0208 l:000198 d:000207 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.r 
c:0055 p:0032 s:0206 b:0206 l:000205 d:000205 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:21 
c:0054 p:0052 s:0199 b:0199 l:000198 d:000198 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.r 
c:0053 p:0018 s:0192 b:0192 l:000191 d:000191 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0052 p:0013 s:0187 b:0187 l:000186 d:000186 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0051 p:0011 s:0184 b:0184 l:000183 d:000183 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0050 p:0136 s:0180 b:0180 l:000179 d:000179 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0049 p:0131 s:0177 b:0177 l:000176 d:000176 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0048 p:0054 s:0174 b:0174 l:000173 d:000173 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0047 p:---- s:0167 b:0167 l:000166 d:000166 FINISH 
c:0046 p:---- s:0165 b:0165 l:000164 d:000164 CFUNC :new 
c:0045 p:0186 s:0158 b:0158 l:000157 d:000157 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter 
c:0044 p:0045 s:0149 b:0149 l:000148 d:000148 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0043 p:0011 s:0146 b:0146 l:000145 d:000145 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0042 p:0048 s:0142 b:0142 l:000128 d:000141 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0041 p:---- s:0139 b:0139 l:000138 d:000138 FINISH 
c:0040 p:---- s:0137 b:0137 l:000136 d:000136 CFUNC :loop 
c:0039 p:0009 s:0134 b:0134 l:000128 d:000133 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0038 p:0019 s:0132 b:0132 l:000131 d:000131 METHOD /Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201 
c:0037 p:0013 s:0129 b:0129 l:000128 d:000128 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0036 p:0030 s:0126 b:l:000122 d:000122 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0035 p:0033 s:0120 b:0120 l:000119 d:000119 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0034 p:0018 s:0115 b:0115 l:000114 d:000114 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0033 p:0011 s:0112 b:0112 l:000111 d:000111 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio 
c:0032 p:0020 s:0109 b:0109 l:000108 d:000108 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:486 
c:0031 p:---- s:0103 b:0103 l:000102 d:000102 FINISH 
c:0030 p:---- s:0101 b:0101 l:000100 d:000100 CFUNC :new 
c:0029 p:0020 s:0095 b:0095 l:000094 d:000094 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:433 
c:0028 p:0083 s:0090 b:0090 l:000089 d:000089 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:415 
c:0027 p:0102 s:0085 b:0085 l:000d58 d:000084 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:142 
c:0026 p:---- s:0083 b:0083 l:000082 d:000082 FINISH 
c:0025 p:---- s:0081 b:0081 l:000080 d:000080 CFUNC :call 
c:0024 p:0043 s:0076 b:0076 l:000067 d:000075 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:636 
c:0023 p:---- s:0073 b:0073 l:000072 d:000072 FINISH 
c:0022 p:---- s:0071 b:0071 l:000070 d:000070 CFUNC :each 
c:0021 p:0171 s:0068 b:0068 l:000067 d:000067 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:631 
c:0020 p:0110 s:0064 b:0064 l:000058 d:000063 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:597 
c:0019 p:0019 s:0062 b:0062 l:000061 d:000061 METHOD /Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201 
c:0018 p:0033 s:0059 b:0059 l:000058 d:000058 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:590 
c:0017 p:0048 s:0053 b:0053 l:000052 d:000052 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:583 
c:0016 p:0045 s:0048 b:0048 l:000047 d:000047 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2051 
c:0015 p:0012 s:0041 b:0041 l:000026 d:000040 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2029 
c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH 
c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC :each 
c:0012 p:0069 s:0033 b:0033 l:000026 d:000032 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2029 
c:0011 p:0009 s:0031 b:0031 l:000030 d:000030 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/airbrake-3.0.9/lib/airbrake/rake_handler.rb:33 
c:0010 p:0011 s:0027 b:0027 l:000026 d:000026 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2023 
c:0009 p:0029 s:0024 b:0024 l:000017 d:000023 BLOCK /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2001 
c:0008 p:0009 s:0022 b:0022 l:000021 d:000021 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2068 
c:0007 p:0011 s:0018 b:0018 l:000017 d:000017 METHOD /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:1998 
c:0006 p:0036 s:0015 b:0015 l:000014 d:000014 TOP /Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/bin/rake:31 
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH 
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load 
c:0003 p:0127 s:0007 b:0007 l:0014e8 d:000f40 EVAL /Users/tamer/.rvm/gems/[email protected]_app/bin/rake:19 
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH 
c:0001 p:0000 s:0002 b:0002 l:0014e8 d:0014e8 TOP 
--------------------------- 
-- Ruby level backtrace information ---------------------------------------- 
/Users/tamer/.rvm/gems/[email protected]_app/bin/rake:19:in `<main>' 
/Users/tamer/.rvm/gems/[email protected]_app/bin/rake:19:in `load' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/bin/rake:31:in `<top (required)>' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/airbrake-3.0.9/lib/airbrake/rake_handler.rb:33:in `standard_exception_handling' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2029:in `each' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:631:in `execute' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:631:in `each' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/rake-0.8.7/lib/rake.rb:636:in `call' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:142:in `block (2 levels) in <top (required)>' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:415:in `migrate' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:433:in `up' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:433:in `new' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:486:in `initialize' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:316:in `retrieve_connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:93:in `connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `checkout' 
/Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in `block in checkout' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in `loop' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `block (2 levels) in checkout' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `checkout_new_connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:228:in `new_connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:25:in `postgresql_connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:25:in `new' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:228:in `initialize' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:939:in `connect' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:956:in `configure_connection' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:278:in `set_standard_conforming_strings' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:699:in `client_min_messages' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:483:in `query' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:195:in `log' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:197:in `block in log' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:487:in `block in query' 
/Users/tamer/.rvm/gems/[email protected]_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:487:in `exec' 

-- C level backtrace information ------------------------------------------- 

[NOTE] 
You may have encountered a bug in the Ruby interpreter or extension libraries. 
Bug reports are welcome. 
For details: http://www.ruby-lang.org/bugreport.html 

Abort trap 

Mi archivo database.yml se parece a esto

development: 
encoding: unicode 
adapter: postgresql 
username: postgres 
port: 5432 
host: localhost 
database: test 
password: password 

Alguna idea de lo que estoy haciendo wrong..these son las credenciales correctas porque conntect a esta postgres db con una herramienta de interfaz gráfica de usuario con estos creds

utilicé esta link para instalar la gema pg

+1

El mismo problema si se ejecuta? $ bundle exec rake db: migrate –

+0

Acabo de recibir exactamente el mismo problema. Sin embargo: Linux, ruby ​​1.9.3p0 y AR 3.2.1 –

Respuesta

0

me gustaría probar el siguiente:

  1. quitar la línea de host
  2. de ejecución de actualizaciones paquete
  3. cambiar el nombre de la base de datos, sólo para asegurarse de su fresca
  4. carrera de rake db: crear
  5. carrera de rake db: migrate

He tenido problemas donde mi pg joya no es la versión correcta para mi versión de rieles

3

Dado que tiene una falla de segmentación real, apostaría a un problema con su gema pg junto con libpg. ¿Por casualidad actualizaste tu sistema operativo últimamente?

Si esto parece razonable, intente guardar una copia de seguridad de su base de datos, nukeando su instalación existente de pg (base de datos, bibliotecas y gemas), y luego reinstalarlo todo con la esperanza de deshacerse de las incompatibilidades que están causando la problema.

+0

+1 para detectar SIG11 y hacer las preguntas correctas – krichard

1

Tengo bases de datos mysql y postgresql en la misma aplicación. Estos son los pasos que he seguido para configurar la base de datos postgresql.

  1. Instalar PostgreSQL y sus bibliotecas sudo apt-get install postgresql postgresql-contrib libpq-dev
  2. Después de la instalación crear un usuario para PostgreSQL sudo -u postgres createuser --superuser $USER o sudo -u postgres createuser pgs_root
  3. Establecer contraseña de usuario para el usuario PostgreSQL sudo -u postgres psql postgres (For psql prompt) postgres=# \password <user> para ex.- postgres=# \passsword pgs_root
  4. Configure la p ostgresql.conf archivo para hacer PostgreSQL escuche a localhost o escuchar en una IP externa o algo así, cambiar esta línea ya sea a la IP o 'localhost' gedit /etc/postgresql/8.4/main/postgresql.conf listen_addresses = 'localhost'
  5. Para que su aplicación se conecte con la base de datos presente en PostgreSQL, configúrela en la base de datos.yml

    development_postgres: adapter: postgresql database: connect_postgres username: pgs_root password: root123 host: 127.0.0.1

  6. rake db:create RAILS_ENV=development_postgres

Al igual que el navegador consulta MySQL, hay una interfaz gráfica de usuario para PostgreSQL llamada pgadmin. Para instalar la actualización

sudo apt-get install pgadmin3 
0

todas las gemas mediante el comando Paquete de actualización a continuación, ejecutar bundle exec rake db: migrate, funciona para mí.

mejor suerte

0

que tenían el mismo problema y probado casi todas las soluciones en Internet sin ningún resultado.

Pero finalmente encontré la solución.

La respuesta es nuke (reinstalar) todo. Eso significa: PostgreSQL

  • resinstall y sus bibliotecas (postgresql-9.1 postgresql-client postgresql-client-9.1 postgresql-client-common postgresql-common postgresql-contrib postgresql-contrib-9.1 postgresql-server-dev-9.1 libpgsql-ruby libpq-dev etc)

  • eliminar totalmente y crean gemsets Ruby (la que está pinchado)

  • Reinstalar Rubí por ejemplo. rvm reinstall 1.9.3 (esto es muy importante, sin ese paso no funcionará)

  • Si tiene bibliotecas obsoletas (libpgsql-ruby1.8 etc.) elimínelas.

PD Este problema apareció en mi máquina cuando actualicé Debian (de Squeeze a Wheezy).

Editar:

Más explicación para este error:

https://bitbucket.org/ged/ruby-pg/issue/76/segfault-on-ruby-18-and-ruby-19-using#comment-590323

0

a veces es causada por un choque entre múltiples versiones libssl

intentarlo de:

  • apt-ge t eliminar libssl0.9.8
  • RVM reinstalación por defecto
Cuestiones relacionadas