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

cursor next/hasnext throws MongoException at random

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Admin
    • Labels:
      None
    • ALL
    • Hide
      populate a collection with somewhere around 100k entries.
      do until the exception occurs
         get a cursor from a quey on the collection
         while hasNext()
             next()
         close cursor
      
      Show
      populate a collection with somewhere around 100k entries. do until the exception occurs get a cursor from a quey on the collection while hasNext() next() close cursor

      Once we went to using shards, there have been several issues with cursors that occur randomly. One issue we having is a timeout condition where a MongoException is thrown. All of the information that I have found indicates that this is due to the cursor not being used within 10 minutes. However, I know this is not the case because I was able to create a test case that recreated the problem. It doesn't happen very often but it does occur.

      Our application is primarily a write oriented where multiple threads extract data from external source and write the data to one or more collections. There may be 1 or 30 million entries in a collection at the end of the data gathering process. This data is then processed and filter into other collections. While processing and filtering the data, a cursor is usually obtained. Most of the time there isn't a problem but ever so often the MongoException is throw while processing the cursor. Altering the batch size for the cursor doesn't seem to change anything.

      We actually have recovery code in place that catches the exception and creates a new cursor and then does a skip() to the current count. This error will occur anywhere from 10 to 40 times a day. I am not sure how many cursors are actually opened but the number of times this occurs is enough to warrant attention.

            Assignee:
            Unassigned Unassigned
            Reporter:
            bmwmaestoso bob whitehurst
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: