segfault on ruby 1.8 and ruby 1.9 using activerecord with pg 0.11.0

Anonymous avatarAnonymous created an issue

I don't know if it's an activerecord bug or pg gem bug but as it's a segfault, I would think it's more likely a gem using C extension. Using ruby 1.8.7 or 1.9.2p180 and Rails 2.3.10 or Rails 3.1.rc4 with libpq-dev 9.0.4-1+b1 (debian), I got everytime a segfault when trying to access the database.

/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:987: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]

-- control frame ----------
c:0074 p:---- s:0285 b:0285 l:000284 d:000284 CFUNC  :initialize
c:0073 p:---- s:0283 b:0283 l:000282 d:000282 CFUNC  :new
c:0072 p:0020 s:0273 b:0273 l:000272 d:000272 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:98
c:0071 p:0055 s:0270 b:0270 l:000269 d:000269 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:26
c:0070 p:---- s:0263 b:0263 l:000262 d:000262 FINISH
c:0069 p:---- s:0261 b:0261 l:000260 d:000260 CFUNC  :new
c:0068 p:0174 s:0254 b:0254 l:000253 d:000253 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:27
c:0067 p:0045 s:0245 b:0245 l:000244 d:000244 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool
c:0066 p:0033 s:0242 b:0242 l:000241 d:000241 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool
c:0065 p:0048 s:0238 b:0238 l:000224 d:000237 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool
c:0064 p:---- s:0235 b:0235 l:000234 d:000234 FINISH
c:0063 p:---- s:0233 b:0233 l:000232 d:000232 CFUNC  :loop
c:0062 p:0009 s:0230 b:0230 l:000224 d:000229 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool
c:0061 p:0019 s:0228 b:0228 l:000227 d:000227 METHOD /home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201
c:0060 p:0013 s:0225 b:0225 l:000224 d:000224 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool
c:0059 p:0030 s:0222 b:0219 l:000218 d:000218 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool
c:0058 p:0033 s:0216 b:0216 l:000215 d:000215 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool
c:0057 p:0018 s:0211 b:0211 l:000210 d:000210 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_spec
c:0056 p:0011 s:0208 b:0208 l:000207 d:000207 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_spec
c:0055 p:0155 s:0205 b:0205 l:000204 d:000204 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations/builder/has_and_belongs_to_many
c:0054 p:0023 s:0201 b:0201 l:000200 d:000200 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations/builder/has_and_belongs_to_many
c:0053 p:0025 s:0197 b:0197 l:000196 d:000196 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations/builder/collection_association.
c:0052 p:0030 s:0190 b:0190 l:000189 d:000189 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations.rb:1574
c:0051 p:0057 s:0184 b:0184 l:000183 d:000183 CLASS  /home/eppo/git/mono-ror/app/models/user.rb:4
c:0050 p:0017 s:0182 b:0182 l:000181 d:000181 TOP    /home/eppo/git/mono-ror/app/models/user.rb:1
c:0049 p:---- s:0180 b:0180 l:000179 d:000179 FINISH
c:0048 p:---- s:0178 b:0178 l:000177 d:000177 CFUNC  :load
c:0047 p:0018 s:0174 b:0174 l:000165 d:000173 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:452
c:0046 p:0045 s:0172 b:0172 l:000171 d:000171 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639
c:0045 p:0086 s:0166 b:0166 l:000165 d:000165 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:451
c:0044 p:0194 s:0158 b:0158 l:000157 d:000157 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:338
c:0043 p:0277 s:0150 b:0150 l:000149 d:000149 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:489
c:0042 p:0036 s:0137 b:0137 l:000127 d:000136 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:181
c:0041 p:---- s:0133 b:0133 l:000132 d:000132 FINISH
c:0040 p:---- s:0131 b:0131 l:000130 d:000130 CFUNC  :each
c:0039 p:0074 s:0128 b:0128 l:000127 d:000127 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:179
c:0038 p:---- s:0121 b:0121 l:000120 d:000120 FINISH
c:0037 p:0007 s:0119 b:0119 l:000118 d:000118 TOP    /home/eppo/git/mono-ror/config/initializers/rolify.rb:1
c:0036 p:---- s:0117 b:0117 l:000116 d:000116 FINISH
c:0035 p:---- s:0115 b:0115 l:000114 d:000114 CFUNC  :load
c:0034 p:0012 s:0111 b:0111 l:000095 d:000110 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233
c:0033 p:0005 s:0109 b:0109 l:000100 d:000108 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223
c:0032 p:0045 s:0107 b:0107 l:000106 d:000106 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639
c:0031 p:0041 s:0101 b:0101 l:000100 d:000100 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223
c:0030 p:0013 s:0096 b:0096 l:000095 d:000095 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233
c:0029 p:0012 s:0091 b:0091 l:00215c d:000090 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/engine.rb:544
c:0028 p:---- s:0088 b:0088 l:000087 d:000087 FINISH
c:0027 p:---- s:0086 b:0086 l:000085 d:000085 CFUNC  :each
c:0026 p:0037 s:0083 b:0083 l:00215c d:000082 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/engine.rb:543
c:0025 p:---- s:0081 b:0081 l:000080 d:000080 FINISH
c:0024 p:---- s:0079 b:0079 l:000078 d:000078 CFUNC  :instance_exec
c:0023 p:0022 s:0075 b:0075 l:000074 d:000074 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25
c:0022 p:0014 s:0071 b:0071 l:000062 d:000070 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:50
c:0021 p:---- s:0068 b:0068 l:000067 d:000067 FINISH
c:0020 p:---- s:0066 b:0066 l:000065 d:000065 CFUNC  :each
c:0019 p:0042 s:0063 b:0063 l:000062 d:000062 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49
c:0018 p:0029 s:0059 b:0059 l:000058 d:000058 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/application.rb:96
c:0017 p:0021 s:0056 b:0056 l:000055 d:000055 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30
c:0016 p:---- s:0051 b:0051 l:000050 d:000050 FINISH
c:0015 p:0044 s:0049 b:0049 l:000048 d:000048 TOP    /home/eppo/git/mono-ror/config/environment.rb:5
c:0014 p:---- s:0047 b:0047 l:000046 d:000046 FINISH
c:0013 p:---- s:0045 b:0045 l:000044 d:000044 CFUNC  :require
c:0012 p:0012 s:0041 b:0041 l:000025 d:000040 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237
c:0011 p:0005 s:0039 b:0039 l:000030 d:000038 BLOCK  /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223
c:0010 p:0045 s:0037 b:0037 l:000036 d:000036 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639
c:0009 p:0041 s:0031 b:0031 l:000030 d:000030 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223
c:0008 p:0013 s:0026 b:0026 l:000025 d:000025 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237
c:0007 p:0046 s:0021 b:0021 l:000020 d:000020 METHOD /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/application.rb:78
c:0006 p:0399 s:0017 b:0017 l:000016 d:000016 TOP    /home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands.rb:22
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :require
c:0003 p:0061 s:0006 b:0006 l:001bdc d:001abc EVAL   script/rails:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001bdc d:001bdc TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
script/rails:6:in `<main>'
script/rails:6:in `require'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands.rb:22:in `<top (required)>'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/application.rb:78:in `require_environment!'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
/home/eppo/git/mono-ror/config/environment.rb:5:in `<top (required)>'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/application.rb:96:in `initialize!'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `run_initializers'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `each'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:50:in `block in run_initializers'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `run'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `instance_exec'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/engine.rb:543:in `block in <class:Engine>'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/engine.rb:543:in `each'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/engine.rb:544:in `block (2 levels) in <class:Engine>'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `block in load'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
/home/eppo/git/mono-ror/config/initializers/rolify.rb:1:in `<top (required)>'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:179:in `const_missing'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:179:in `each'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:181:in `block in const_missing'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:489:in `load_missing_constant'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:338:in `require_or_load'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:451:in `load_file'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:452:in `block in load_file'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:452:in `load'
/home/eppo/git/mono-ror/app/models/user.rb:1:in `<top (required)>'
/home/eppo/git/mono-ror/app/models/user.rb:4:in `<class:User>'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations.rb:1574:in `has_and_belongs_to_many'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations/builder/collection_association.rb:13:in `build'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations/builder/has_and_belongs_to_many.rb:9:in `build'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/associations/builder/has_and_belongs_to_many.rb:43:in `check_validity'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:107:in `retrieve_connection'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:388:in `retrieve_connection'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:151:in `connection'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:249:in `checkout'
/home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:250:in `block in checkout'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:250:in `loop'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:254:in `block (2 levels) in checkout'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:302:in `checkout_new_connection'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `new_connection'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:27:in `postgresql_connection'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:27:in `new'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:260:in `initialize'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:987:in `connect'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:987:in `new'
/home/eppo/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:987:in `initialize'

it's my own app but trying with redmine or new rails app from scratch does the same. is there any incompatibility between this gem and postgresql version on debian ?

Comments (10)

  1. Michael Granger
    • changed status to open

    Thanks for your report.

    There aren't any incompatibilities between the 'pg' gem and PostgreSQL 9.0.x that I know of (that's the combination I use in production), but I haven't tested on Debian in particular.

    Your backtrace leads me to believe that if there is something segfaulting in pg, that it's being caused by a connection argument, but of course I can't see what arguments are being passed to the constructor. It would help a lot if you could reduce this to a test case outside of Rails/ActiveRecord. For example, dump out `@connection_parameters` before line 987 in `postgresql_adapter.rb`, then test them in this code:

    @connection_parameters = [ ...the dumped parameters from above...]
    p PGconn.connect( *@connection_parameters )
    

    If that segfaults, then that's at least something I can run on my machine without having to install Rails and duplicate your app and runtime environment. If it doesn't then that's good information, too.

  2. EppO

    Hello, thanks for your support, sorry for the delay, no bitbucket account, no notification...

    I tried what you said, there is no segfault when I do only:

    require 'pg'
    
    conn_params = ["127.0.0.1", 5432, nil, nil, "redmine", "redmine", "password1234567890"]
    PGconn.connect(*conn_params)
    

    I only have pg 0.11.0 installed so I think it's the same version than redmine is using with active_record.

  3. Anonymous

    In case it helps - I was having a segmentation fault on the pg gem when trying to create a connection via HTTP.

    There is an issue with OpenSSL using the MacPorts installation of Postgres (and Mysql). I killed MacPorts, switched to Homebrew and it's all working now.

  4. EppO

    I successfully made it segfault adding openssl before requiring pg gem:

    require 'openssl'
    require 'pg'
    
    conn_params = ["127.0.0.1", 5432, nil, nil, "redmine", "redmine", "password1234567890"]
    PGconn.connect(*conn_params)
    

    It does:

    # ruby segfault.rb
    segfault.rb:5: [BUG] Segmentation fault
    ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
    
         -- control frame ----------
    c:0005 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC  :initialize
    c:0004 p:---- s:0017 b:0017 l:000016 d:000016 CFUNC  :new
    c:0003 p:0061 s:0007 b:0007 l:0021fc d:002028 EVAL   segfault.rb:5
    c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
    c:0001 p:0000 s:0002 b:0002 l:0021fc d:0021fc TOP   
    ---------------------------
    -- Ruby level backtrace information ----------------------------------------
    segfault.rb:5:in `<main>'
    segfault.rb:5:in `new'
    segfault.rb:5:in `initialize'
    
    -- C level backtrace information -------------------------------------------
    /home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_vm_bugreport+0x72) [0xb7819ac2]
    /home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x56271) [0xb76f3271]
    /home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_bug+0x3a) [0xb76f336a]
    /home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x10851c) [0xb77a551c]
    [0xb788e40c]
    [(nil)]
    [0x41]
    
    [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
    
    zsh: abort      ruby segfault.rb
    

    I guess it's a conflict between openssl library and the pg gem but what is the workaround ?

  5. Michael Granger

    It's not a conflict between openssl and the pg library, it's a conflict between two versions of the openssl library -- the one your Ruby was compiled with, and the one your libpq was compiled with.

    The solution is to compile both Ruby and libpq with the same version of openssl, and then not upgrade it without re-compiling. When you load a different version of the library than it was compiled against, and its interface changes at all, you get problems like this. That's one of the perils of compiling stuff yourself, or using tools that do it for you without being aware of other dependencies. It falls on your to be aware of these dependencies yourself.

    This ticket is a duplicate of #77, so I'm closing it, but I'll try to figure out a way of detecting this problem at compile time since it seems prevalent, especially with the rising popularity of rvm.

  6. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.