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

Internal API conflict with relation or attribute named 'session'

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 7.1.0.rc0, 6.4.1, 7.0.1
    • Affects Version/s: 6.4.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      mongodb: 2.4, 3.6 (both affected)
      rails: 5.1.5
      ruby: 2.4.1p111

      After upgrading mongoid-rspec it also upgrades mongoid from 6.2.1 to 6.4.0 and mongo from 2.4.3 to 2.5.1.

      -    mongo (2.4.3)
      -      bson (>= 4.2.1, < 5.0.0)
      -    mongoid (6.2.1)
      -      activemodel (~> 5.1)
      -      mongo (>= 2.4.1, < 3.0.0)
      +    mongo (2.5.1)
      +      bson (>= 4.3.0, < 5.0.0)
      +    mongoid (6.4.0)
      +      activemodel (>= 5.1, < 6.0.0)
      +      mongo (>= 2.5.1, < 3.0.0)
      +    mongoid-compatibility (0.5.1)
      +      activesupport
      +      mongoid (>= 2.0)
      

      After this tests of my rails app failed with the following error:

      undefined method `retry_writes?' for true:TrueClass
      

      It happens when I am trying to update the image attributes.

      def edit
        load_image
        @image.update_attributes shown_at: DateTime.now
         render layout: 'plain'
      end
      

      Tracing back it shows me that the code really breaks is here: https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/retryable.rb#L125

      def retry_write_allowed?(session, write_concern)
         session && session.retry_writes? &&
             (write_concern.nil? || write_concern.acknowledged?)
      end
      

      So session is here only a boolean and not a session object somehow. I could not find any infos concerning upgrade changes so i consider this as a bug?

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            gurix Markus Graf
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: