Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7928

Deleting documents constantly corrupts collection

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.2
    • None
    • Environment:
      Debian 5, Linux kernel 2.6.26-2-amd64, mongod 2.2.2 Dec 13, php driver 1.3.0RC3-dev, node.js driver 1.2.-0
    • Linux

      I have collection named "games" with rapidly changing content - documents are inserted every few seconds. Collection was TTL-indexed before with field "info.createtime".

      Problem is that I constantly get this error with the collection:

      Invalid BSONObj size: -286331154 (0xEEEEEEEE) first element: _id: ObjectId('50b5bafbae210be727000000')

      I have discovered that it appears in regards of deleting documents while other clients trying to get some query results by that index. I tried to remove expireAfterSeconds attribute from index and do cron job removing expired items instead (with $atomic option), but the error remains the same.

      I have struck into this problem, because the error exists on constant basis. Console command db.repairDatabase() fixes the problem but it reappears in next few hours.

      After further discovering I was able to workaround this by calling reIndex() every time I remove expired items.

      gamesCollection.remove( {'info.createtime': {$lt: hour_ago}, $atomic: 1}, {}, function() {
      gamesCollection.reIndex(function(err, result) {});
      });

      The error didn't show anymore. But it is ugly way.

      document example: http://pastebin.com/uFMrVfLR
      db.games.getIndexes(): http://pastebin.com/Cz95ejK8
      db.games.validate(): http://pastebin.com/BRfqp0kq

            Assignee:
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Reporter:
            chivchalov@gmail.com Artem Chivchalov
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: