ibmdb / ruby-ibmdb

Rails Adapter/Ruby driver for IBM DB2 and IBM Informix
43 stars 49 forks source link

Segmentation fault at 0x0000000000000048 #143

Closed styrken closed 1 year ago

styrken commented 1 year ago

Hi,

I am getting this strange segmentation fault. Any pointers on how to debug that? Not sure if its a ruby issue or db issue.

Puma starting in single mode...
* Puma version: 5.6.5 (ruby 3.0.2-p107) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: staging
*          PID: 2093863
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop
/data/apps/staging/shared/bundle/ruby/3.0.0/gems/ibm_db-5.3.2/lib/active_record/connection_adapters/ibm_db_adapter.rb:754: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0097 p:---- s:0671 e:000670 CFUNC  :server_info
c:0096 p:0289 s:0666 e:000665 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/ibm_db-5.3.2/lib/active_record/connection_adapters/ibm_db_adapter.rb:754 [FINISH]
c:0095 p:---- s:0655 e:000654 CFUNC  :new
c:0094 p:0665 s:0646 e:000645 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/ibm_db-5.3.2/lib/active_record/connection_adapters/ibm_db_adapter.rb:346 [FINISH]
c:0093 p:---- s:0629 e:000628 CFUNC  :public_send
c:0092 p:0021 s:0623 e:000622 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connec
c:0091 p:0021 s:0619 e:000618 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connec
c:0090 p:0014 s:0615 e:000614 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connec
c:0089 p:0012 s:0609 e:000608 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connec
c:0088 p:0011 s:0603 e:000601 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connec
c:0087 p:0021 s:0597 e:000593 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connec
c:0086 p:0291 s:0590 e:000589 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connec
c:0085 p:0014 s:0580 e:000579 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:327
c:0084 p:0003 s:0576 e:000575 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:283
c:0083 p:0017 s:0572 e:000571 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/delegation.rb:93
c:0082 p:0012 s:0564 e:000561 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/query_methods.rb:1394
c:0081 p:0011 s:0556 e:000555 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/query_methods.rb:360
c:0080 p:0019 s:0551 e:000550 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/query_methods.rb:355
c:0079 p:0082 s:0546 e:000545 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/finder_methods.rb:583
c:0078 p:0024 s:0542 e:000541 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/finder_methods.rb:545
c:0077 p:0034 s:0535 e:000531 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/finder_methods.rb:538
c:0076 p:0027 s:0527 e:000526 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/relation/finder_methods.rb:122SEGV
 received in SEGV handler
c:0075 p:0007 s:0522 e:000521 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-session_store-2.0.0/lib/active_record/session_store/session
c:0074 p:0025 s:0517 e:000516 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-session_store-2.0.0/lib/action_dispatch/session/active_reco
c:0073 p:0006 s:0510 e:000509 BLOCK  /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-session_store-2.0.0/lib/action_dispatch/session/active_reco
c:0072 p:0004 s:0506 e:000505 BLOCK  /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/logger_silence.rb:18
c:0071 p:0017 s:0503 e:000502 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/logger_thread_safe_level.rb:52
c:0070 p:0026 s:0497 e:000496 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/logger_silence.rb:18
c:0069 p:0006 s:0492 e:000491 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-session_store-2.0.0/lib/action_dispatch/session/active_reco
c:0068 p:0007 s:0486 e:000485 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/activerecord-session_store-2.0.0/lib/action_dispatch/session/active_reco
c:0067 p:0014 s:0479 e:000478 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:314
c:0066 p:0007 s:0472 e:000471 BLOCK  /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/session/abstract_store.r
c:0065 p:0002 s:0469 e:000468 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/session/abstract_store.r
c:0064 p:0004 s:0464 e:000463 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/session/abstract_store.r
c:0063 p:0008 s:0459 e:000458 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/request/session.rb:234
c:0062 p:0015 s:0453 e:000452 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/request/session.rb:226
c:0061 p:0003 s:0449 e:000448 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/request/session.rb:92
c:0060 p:0010 s:0444 e:000443 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/warden-1.2.9/lib/warden/session_serializer.rb:31
c:0059 p:0086 s:0436 e:000435 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/warden-1.2.9/lib/warden/proxy.rb:224
c:0058 p:0009 s:0427 e:000426 METHOD /data/apps/staging/app/config/initializers/admin.rb:3
c:0057 p:0017 s:0421 e:000420 BLOCK  /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/mapper.rb:41 [FINISH]
c:0056 p:---- s:0417 e:000416 CFUNC  :all?
c:0055 p:0006 s:0413 e:000412 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/mapper.rb:40
c:0054 p:0005 s:0408 e:000407 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/mapper.rb:47
c:0053 p:0110 s:0403 e:000402 BLOCK  /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb:50 [FINISH]
c:0052 p:---- s:0390 e:000389 CFUNC  :each
c:0051 p:0008 s:0386 e:000385 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb:32
c:0050 p:0042 s:0381 e:000380 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/route_set.rb:842
c:0049 p:0236 s:0375 e:000374 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100
c:0048 p:0017 s:0361 e:000360 BLOCK  /data/apps/staging/shared/bundle/ruby/3.0.0/gems/warden-1.2.9/lib/warden/manager.rb:36 [FINISH]
c:0047 p:---- s:0358 e:000357 CFUNC  :catch
c:0046 p:0057 s:0353 e:000352 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/warden-1.2.9/lib/warden/manager.rb:34
c:0045 p:0035 s:0347 e:000346 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15
c:0044 p:0007 s:0338 e:000337 METHOD /data/apps/staging/shared/bundle/ruby/3.0.0/gems/rack-2.2.4/lib/rack/etag.rb:27
c:0043 p:0048 s:0327 Aborted (core dumped)
praveen-db2 commented 1 year ago

@styrken few questions for you. This is first time you are using ibm_db adapter ? Are you facing this always or intermittently ?

Looking at call stack, its crashing while ibm_db adapter is fetching server info DB, not sure what caused this. Can you provide us info on how to reproduce this ?

styrken commented 1 year ago

It's not first time. We are upgrading an old Rails app (3+) to 6.1. Most works but this segmentation fault is sometimes thrown (on a specific page).

praveen-db2 commented 1 year ago

@styrken try downgrading or upgrading rails & ruby to previous or next version. Sometimes it resolves.

styrken commented 1 year ago

@praveen-db2 okey let me try downgrading ruby

styrken commented 1 year ago

Hello @praveen-db2, we have tried using ruby 2.7.6p219 and we get this segmentation fault:

* Puma version: 5.6.5 (ruby 2.7.6-p219) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: staging
*          PID: 2237751
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop
/data/apps/apps/shared/bundle/ruby/2.7.0/gems/puma-5.6.5/lib/puma/server.rb:179: SEGV received in SEGV handler
[BUG] Segmentation fault at 0x0000000000000000
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0007 p:---- s:0067 e:000066 CFUNC  :getsockopt
c:0006 p:0059 ./start-staging.sh: line 7: 2237751 Aborted                 (core dumped) RAILS_ENV=staging IBM_DB_HOME=/data/dsdriver/ LD_LIBRARY_PATH=/data/dsdriver/lib:$LD_LIBRARY_PATH bundle exec rails s -b 0.0.0.0
praveen-db2 commented 1 year ago

@styrken its crashing in gem puma. Not sure whats causing these. We can help if anything related to ibm_db gem. Rest you need to figure out.

styrken commented 1 year ago

Hi @praveen-db2 , it seems to start working by simply switching to the Thin web-server instead of PUMA.