title: mongodb inserts silently fail
body: <p>I'm using <code>MongoDB</code> version 2.6.1 on windows platform, 64 bit, 16GB RAM (and using C# mongodb driver).<br>
  In my environment I insert ~15 documents (up to 128B each) every 10 seconds. Each insert action inserts a single document, and currently in my (single) collection I got 621,000 documents.<br>
  Lately, I noticed "holes" of few minutes in all inserts. And when I say "hole" i mean that in the same time range none of the document were inserted.  </p>
  
  <p>To debug, I printed the <code>WriteConcernResult</code> after each insert, and surprisingly, all of the inserted documents that are missing in the query, were successfully inserted:  </p>
  
  <pre><code>WriteConcertResult: writeResult.Ok - True, writeResult.HasLastErrorMessage - False, writeResult.LastErrorMessage - , writeResult.ErrorMessage - , writeResult.Response - { "connectionId" : 57, "n" : 0, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1.0 }
  </code></pre>
  
  <p>To make sure I'm supposed to get exception on failure, I inserted the same document twice.<br>
  Now it just made things more interested since I indeed got the 'duplicate key error', but still couldn't find that document.<br>
  And to make sure I don't have "query" problem I checked if any document was even added to the collection when I caught the hole "in the act" and I found that none were added (even though the write-concern-result says Ok).  </p>
  
  <p>I then turned to mongo log (which I started with -vvvvv) and I couldn't find anything too suspicious:</p>
  
  <pre><code>2014-07-07T19:34:01.393+0300 [journal] journal REMAPPRIVATEVIEW
  2014-07-07T19:34:01.393+0300 [journal] journal REMAPPRIVATEVIEW done startedAt: 5 n:4 0ms
  2014-07-07T19:34:01.393+0300 [journal] groupCommit end
  2014-07-07T19:34:02.219+0300 [conn8] PageFaultException thrown
  2014-07-07T19:34:02.219+0300 [conn8] insert myDb.files ninserted:1 keyUpdates:0 numYields:0 locks(micros) w:120 0ms
  2014-07-07T19:34:02.219+0300 [conn8] run command myDb.$cmd { getlasterror: 1 }
  2014-07-07T19:34:02.219+0300 [conn8] command myDb.$cmd command: getLastError { getlasterror: 1 } ntoreturn:1 keyUpdates:0 numYields:0  reslen:94 0ms
  2014-07-07T19:34:02.219+0300 [conn8] run command myDb.$cmd { findAndModify: "reposInfo", query: { RepositorySizeInBytes: { $exists: true } }, update: { $inc: { RepositorySizeInBytes: 1018460 } }, new: true }
  2014-07-07T19:34:02.219+0300 [conn8] Only one plan is available; it will be run but will not be cached. query: { RepositorySizeInBytes: { $exists: true } } sort: {} projection: {}, planSummary: COLLSCAN
  2014-07-07T19:34:02.219+0300 [conn8] processing update :  query: { _id: ObjectId('538760d681536a0414a23bc9') } updated: { $inc: { RepositorySizeInBytes: 1018460 } } god: 0 upsert: 0 multi: 0 callLogOp: 1 fromMigration: 0 fromReplications: 0
  2014-07-07T19:34:02.219+0300 [conn8] Using idhack: { _id: ObjectId('538760d681536a0414a23bc9') }
  2014-07-07T19:34:02.219+0300 [conn8] update validate options --  updatedFields: Fields:[ RepositorySizeInBytes,] immutableAndSingleValueFields.size:0 fromRepl: 0 validate:1
  2014-07-07T19:34:02.219+0300 [conn8] UpdateResult --  upserted: {} modifiers: 1 existing: 1 numDocsModified: 1 numMatched: 1
  2014-07-07T19:34:02.219+0300 [conn8] update result:  upserted: {} modifiers: 1 existing: 1 numDocsModified: 1 numMatched: 1
  2014-07-07T19:34:02.219+0300 [conn8] using modified query to return the new doc: { _id: ObjectId('538760d681536a0414a23bc9') }
  2014-07-07T19:34:02.219+0300 [conn8] Using idhack: query: { _id: ObjectId('538760d681536a0414a23bc9') } sort: {} projection: {}
  2014-07-07T19:34:02.219+0300 [conn8] command myDb.$cmd command: findAndModify { findAndModify: "reposInfo", query: { RepositorySizeInBytes: { $exists: true } }, update: { $inc: { RepositorySizeInBytes: 1018460 } }, new: true } update: { $inc: { RepositorySizeInBytes: 1018460 } } ntoreturn:1 nscanned:1 nscannedObjects:1 nMatched:1 nModified:1 fastmod:1 keyUpdates:0 numYields:0 locks(micros) w:215 reslen:144 0ms
  </code></pre>
  
  <p>I wasn't sure if the "PageFaultException thrown" part was related to the problem, but after reading about this exception I understood it might be normal and then I saw this exception also before real success inserts, so I moved on with that.  </p>
  
  <p>Even though the write-concern-result tell me everything is OK, I still checked <code>serverStatus</code> and <code>currentOp</code> for possible locking action, but couldn't find anything strange there.</p>
  
  <p>And suggestions on how to better debug this situation?<br>
  boring info:<br>
  - mongodb instance is created using <code>new MongoClient(addr)</code> > <code>client.GetServer()</code> > <code>server.GetDatabase(dbName)</code> (so write-concern is enabled on default).<br>
  - The collection is totally standard (not a capped-collection, not sharded, without replica set)<br>
  - The _id used for the inserted documents is <code>BinData</code><br>
  - The mongo process takes (according to Task Manager) 38,148K RAM, only 20% of the server RAM is in use.<br>
  - The mongo version is updated, and is 64 bit.</p>
  
  <p><strong>--Update--</strong></p>
  
  <p>When I search for the document by its BinData _id, I can (somehow) get it, but it's invisible for any other way.<br>
  For instance, when I search this:
  <code>db.files.find({"_id": BinData(0, "alnYNFB8XxGo+KB8A70vCw==")})</code><br>
  I get (first object):</p>
  
  <pre><code>{
          "_id" : BinData(0,"alnYNFB8XxGo+KB8A70vCw=="),
          "dId" : "537cbafd81536a0aa03f6be3",
          "cN" : 1,
          "ty" : 0,
          "sT" : ISODate("2014-07-08T06:53:20.534Z"),
          "eT" : ISODate("2014-07-08T06:53:30.845Z"),
          "hS" : 40,
          "sId" : 1
  }
  </code></pre>
  
  <p>But when I search by "sT", I find None (when I do the same search by "sT" for documents that I see in collection then I can find them).<br>
  What da...</p>
  
  <p><strong>-- Update (to Asya's comment) --</strong><br>
  Search by "sT" example for "good" document:  </p>
  
  <pre><code>&gt;&gt; goodDate = ISODate("2014-07-08T06:55:59.056Z");
  &gt;&gt; db.files.find({"sT": goodDate})
  </code></pre>
  
  <p>I get the returned document. Then I do:</p>
  
  <pre><code>&gt;&gt; missDate = ISODate("2014-07-08T06:53:20.534Z")
  &gt;&gt; db.files.find({"sT": missDate})
  </code></pre>
  
  <p>Find nothing!  </p>
  
  <p>Another example:  </p>
  
  <pre><code>&gt;&gt; db.files.find({"sT": {$gte: missDate}})
  </code></pre>
  
  <p>first result starts with "sT" : <code>ISODate("2014-07-08T06:55:41.446Z")</code>  </p>
  
  <p>the thing is, like I said before, after the log tells me the insert was successful, I'm checking <code>db.files.find().length()</code> and it's the same.<br>
  I even did a for loop on find() and searched for the missing document _id and STILL couldn't find it.</p>
  
  <p><strong>--update--</strong><br>
  after some tests (thanks to mongo forum), we decided this issue should come as a ticket.<br>
  so a ticket was posted in mongo r&amp;d community. I'll continue and update here when we know for sure what's going on.</p>