RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.39k stars 10.51k forks source link

Livechat E11000 duplicate key error index: rocketchat.rocketchat_subscription #14847

Closed alebeta90 closed 5 years ago

alebeta90 commented 5 years ago

Description:

When livechat-guest from my wordpress try to contact me using the livechat it give an Internal Server Error.

Some times the message does not appear in the livechat from livechat-guest side, but the message never arrive to the agent.

The system was working, till I need to remove to users from the livechat agent. I tried adding them back but nothing.

Steps to reproduce:

  1. Go to livechat management panel -> User Management
  2. Delete an livechat-agent

Expected behavior:

Livechat should be working

Actual behavior:

It shows internal server error message from guest side and also in current chats windows if some one try to reply to the customer

Server Setup Information:

Relevant logs:

Exception while invoking method 'joinRoom' { BulkWriteError: E11000 duplicate key error index: rocketchat.rocketchat_subscription.$u._id_1_name_1_t_1_code_1 dup key: { : "we2Dh5nchY9RyCSna", : null, : "l", : null }

at OrderedBulkOperation.handleWriteError (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/bulk/common.js:1048:11)

at resultHandler (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/bulk/ordered.js:159:23)

at /app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:532:18

at _combinedTickCallback (internal/process/next_tick.js:131:7)

at process._tickDomainCallback (internal/process/next_tick.js:218:9)

index: 0,

code: 11000,

errmsg: 'E11000 duplicate key error index: rocketchat.rocketchat_subscription.$u._id_1_name_1_t_1_code_1 dup key: { : "we2Dh5nchY9RyCSna", : null, : "l", : null }',

op:

{ open: true,

 alert: true,

 unread: 1,

 userMentions: 1,

 groupMentions: 0,

 ts: 2019-06-21T13:51:30.583Z,

 rid: 'wNtbafnLsfMRHikQc',

 name: undefined,

 fname: 'centos-test',

 customFields: undefined,
renatobecker-zz commented 5 years ago

@alebeta90 There is an index in your subscription collection that does not exist anymore: https://github.com/RocketChat/Rocket.Chat/blob/develop/server/startup/migrations/v122.js#L7

reetp commented 5 years ago

@alebeta90 There is an index in your subscription collection that does not exist anymore: https://github.com/RocketChat/Rocket.Chat/blob/develop/server/startup/migrations/v122.js#L7

Can you demonstrate how that might be used to fix the issue which is seen a lot?

renatobecker-zz commented 5 years ago

@alebeta90 There is an index in your subscription collection that does not exist anymore: https://github.com/RocketChat/Rocket.Chat/blob/develop/server/startup/migrations/v122.js#L7

Can you demonstrate how that might be used to fix the issue which is seen a lot?

In this case, he will need to remove the related index directly from the database / collection.

reetp commented 5 years ago

An actual example of a sample command would help.

E.g what command would you need to enter at a mongo prompt to do it?

I have no idea myself and can't see any simple examples.

This should be documented.

alebeta90 commented 5 years ago

Hi @renatobecker

thank you very much for the guidance, I just need to install MongoDB Compass, to access the database and in the collection rocketchat_subscription I deleted the mentioned index and now it is working.

I used MongoDB Compass, just to make it easier for me, but for sure it can be done with command line.

Thanks and all the best