MongoDuplicateKeyException error in logs

  • An unhandled exception might be thrown while using MongoDB session state provider. The issue occurs when sending many simultaneous requests with the same session cookies. Sitecore XP instance tries to add the already existent session to the session database. It is not reproducible with other providers.

    The following message can be found in the log records:

    Exception: MongoDB.Driver.MongoDuplicateKeyException
    Message: WriteConcern detected an error ''. (Response was { "ok" : 1, "code" : 11000, "err" : "E11000 duplicate key error collection: prod_TCFBank_com_local_session.sessions index: _id_ dup key: { : { s: \"4b139a8f-2458-4e68-9b03-b1ff5542db2b\", a: \"shared\" } }", "n" : NumberLong(0), "updatedExisting" : false }).
    Source: MongoDB.Driver
      at Sitecore.Analytics.Pipelines.CommitSession.SubmitSession.Process(CommitSessionPipelineArgs args)
      ...
  • To resolve the issue, consider one of the following options:

Applies to:

CMS 8.2 Update-2 - 9.0 Update-2

CMS 9.1 Initial Release

April 14, 2020
April 14, 2020

Reference number:

155149