Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2475

Consistent segfaults while persisting a document

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.10
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      I am using mongoid-3.0.9 and ruby-1.9.30p194 on an ubuntu box. I have a sharded mongodb (2 shards, each shard with 3 replicas) and am running in "safe :

      {w : majority}

      " mode.

      I have two models (among others) - Photo and Viewable. I am seeing consistent segfaults (every 3-4 minutes) while saving a Viewable to my mongodb. The models are as follows.

      class Viewable
        include Mongoid::Document
        include Mongoid::Timestamps
      
        field :v, as: :viewed_at, type: Time
        field :s, as: :score, type: Float
        field :o, as: :content_owner_id, type: Integer
      
        belongs_to :account, class_name: 'UserAccount', inverse_of: :viewables
        belongs_to :content, polymorphic: true
      
        # Validations.
        validates_presence_of :account, :content
      
        # Shard key.
        shard_key :account_id
      
        # Indexes
        index({ 'account_id' => 1, 'content_type' => 1, 'v' => 1, 's' => -1}, background: true)
        index({ 'account_id' => 1, 'content_id' => 1 }, background: true)
        index({ 'content_id' => 1 }, background: true)
      end
      
      class Photo
        include Mongoid::Document
        include Mongoid::Timestamps
      
        field :e, as: :external_id, type: Integer
        field :t, as: :type
        field :a, as: :album_id
      
        # id is "type-external_id". This is initialized using Photo.get_id.
        field :_id, type: String
      
        # Relationships.
        has_many :emotes, as: :content
        has_many :notifications, as: :content
        embeds_one :emote_count, as: :content, cascade_callbacks: true
        has_many :viewable_users, as: :content, class_name: 'Viewable'
        belongs_to :owner, class_name: 'UserAccount', inverse_of: :photos
      
        # Validations
        validates_presence_of :external_id, :type
      
        # Indexes
        index({ 'owner_id' => 1 }, {background: true, sparse: true })
      end
      

      The stack trace is below.

      Please let me know if there's any other information that I can give to help debug the issue.

      /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/document.rb:108: [BUG] Segmentation fault
      ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

      – Control frame information -----------------------------------------------
      c:0045 p:0017 s:0184 b:0183 l:000182 d:000182 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/document.rb:108
      c:0044 p:---- s:0180 b:0180 l:000179 d:000179 FINISH
      c:0043 p:---- s:0178 b:0178 l:000177 d:000177 CFUNC :include?
      c:0042 p:0015 s:0174 b:0174 l:000173 d:000173 METHOD /home/twurler/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/set.rb:185
      c:0041 p:0014 s:0170 b:0170 l:000144 d:000169 BLOCK /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/callbacks.rb:154
      c:0040 p:---- s:0167 b:0167 l:000166 d:000166 FINISH
      c:0039 p:---- s:0165 b:0165 l:000164 d:000164 CFUNC :each
      c:0038 p:0113 s:0162 b:0162 l:000144 d:000161 BLOCK /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/callbacks.rb:153
      c:0037 p:0025 s:0157 b:0157 l:000156 d:000156 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/relations/accessors.rb:103
      c:0036 p:0027 s:0154 b:0154 l:000144 d:000153 BLOCK /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/callbacks.rb:147
      c:0035 p:---- s:0150 b:0150 l:000149 d:000149 FINISH
      c:0034 p:---- s:0148 b:0148 l:000147 d:000147 CFUNC :each_pair
      c:0033 p:0032 s:0145 b:0145 l:000144 d:000144 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/callbacks.rb:145
      c:0032 p:0013 s:0140 b:0140 l:000139 d:000139 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/callbacks.rb:109
      c:0031 p:0054 s:0134 b:0134 l:0003a8 d:0003a8 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence/modification.rb:23
      c:0030 p:0011 s:0129 b:0129 l:001c78 d:001c78 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence/operations/update.rb:43
      c:0029 p:0030 s:0126 b:0126 l:000125 d:000125 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence.rb:139
      c:0028 p:0049 s:0122 b:0122 l:000121 d:000121 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence.rb:81
      c:0027 p:0023 s:0118 b:0118 l:000117 d:000117 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/relations/proxy.rb:117
      c:0026 p:---- s:0112 b:0112 l:000111 d:000111 FINISH
      c:0025 p:0011 s:0110 b:0110 l:0024b0 d:000109 BLOCK /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/relations/auto_save.rb:72
      c:0024 p:---- s:0107 b:0107 l:000106 d:000106 FINISH
      c:0023 p:---- s:0105 b:0105 l:000104 d:000104 CFUNC :each
      c:0022 p:0109 s:0102 b:0102 l:0024b0 d:000101 LAMBDA /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/relations/auto_save.rb:71
      c:0021 p:---- s:0098 b:0098 l:000097 d:000097 FINISH
      c:0020 p:0082 s:0096 b:0096 l:000095 d:000095 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:409
      c:0019 p:0115 s:0091 b:0091 l:000090 d:000090 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405
      c:0018 p:0027 s:0082 b:0082 l:000081 d:000081 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385
      c:0017 p:0024 s:0077 b:0077 l:000076 d:000076 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81
      c:0016 p:0045 s:0071 b:0071 l:000070 d:000070 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/callbacks.rb:114
      c:0015 p:0047 s:0065 b:0065 l:001208 d:001208 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence/insertion.rb:23
      c:0014 p:0011 s:0060 b:0060 l:002108 d:002108 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence/operations/insert.rb:26
      c:0013 p:0030 s:0057 b:0057 l:000056 d:000056 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence.rb:50
      c:0012 p:0028 s:0053 b:0053 l:000052 d:000052 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence.rb:79
      c:0011 p:0017 s:0049 b:0049 l:000048 d:000048 METHOD /mnt/twurler/shared/bundle/ruby/1.9.1/gems/mongoid-3.0.9/lib/mongoid/persistence.rb:95
      c:0010 p:0535 s:0045 b:0045 l:000025 d:000044 BLOCK /mnt/twurler/releases/20121014183455/lib/facebook_connector.rb:779
      c:0009 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
      c:0008 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC :each
      c:0007 p:0011 s:0033 b:0033 l:000025 d:000032 BLOCK /mnt/twurler/releases/20121014183455/lib/facebook_connector.rb:751
      c:0006 p:0017 s:0030 b:0030 l:000029 d:000029 METHOD /mnt/twurler/releases/20121014183455/lib/facebook_connector.rb:605
      c:0005 p:0110 s:0026 b:0026 l:000025 d:000025 METHOD /mnt/twurler/releases/20121014183455/lib/facebook_connector.rb:749
      c:0004 p:0087 s:0017 b:0017 l:000016 d:000016 METHOD /mnt/twurler/releases/20121014183455/lib/facebook_connector.rb:733
      c:0003 p:0032 s:0008 b:0008 l:0026d8 d:000007 BLOCK /mnt/twurler/releases/20121014183455/lib/facebook_connector.rb:712
      c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
      c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP

            Assignee:
            durran Durran Jordan
            Reporter:
            asasturkar asasturkar
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: