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

undefined method `clear' for true:TrueClass while creating document

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

      I have a really weird error happening sometimes in one of my background jobs. The stack trace I got (the Mongoid-related part) is:

      NoMethodError: undefined method `clear' for true:TrueClass
      .../mongoid-2.0.0/lib/mongoid/attributes/processing.rb:122
      .../mongoid-2.0.0/lib/mongoid/attributes/processing.rb:28
      .../mongoid-2.0.0/lib/mongoid/document.rb:142

      This happened 3 times over a few days, with hundreds of thousands of other similar jobs completing successfully during that time. I can't reproduce it locally on the same data and I can't see any patterns in the inputs or the time when it happens.

      The line of code that runs just before this error is simply Profile.new. From what I can see in the Mongoid code, the methods it runs afterwards iterate over two internal hashes, and then suddenly one of these hashes becomes a boolean true value, which doesn't make any sense to me.

      Any ideas?...

            Assignee:
            Unassigned Unassigned
            Reporter:
            mackuba Kuba Suder
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: