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

Weirdest behavior with Mongoid 3

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

      I'm having the weirdest bug I've ever seen: occasionally my models get mixed up.

      I can't always reproduce the bug, it just happens randomly, and after a few refreshes/minutes it gets back to normal, but when it happens, for example, an instance of the User model get fed with data from policies collection.

      There was even a case that an instance of Policy ended up with database connection information and in another one, an instance of User got a results attribute with the results of an aggregation I had just ran.

      Unfortunately I was dumb enough to lose the sample, but it looked like this:

      #<User _id: , created_at: , updated_at: , name: , ... , results: [ ... ]>
      

      All user's real attributes were null.

      I noticed something else; during one of the times I could reproduce it in development, a simple User.find would return DocumentNotFound, but the ID did existed.

      I have no idea where to begin. I made no changes to the code and, other than that everything else seems fine.

      Does anybody has any insight ?

      It's a Rails 3.2 app, using Mongoid 3.1.6.

      Thanks in advance.

            Assignee:
            Unassigned Unassigned
            Reporter:
            haggen haggen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: