RocketChat / RocketChat/Rocket.Chat
E11000 duplicate key errors
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
I see duplicate errors in logs that leads to errors like Invalid room [error-invalid-room] on createDirectMessage and getRoomByTypeAndName methods.
Steps to reproduce:
- Check logs for E11000 events per day
Expected behavior:
No duplicate errors in logs and normal works of Rocket.Chat server
Actual behavior:
E11000 errors
Server Setup Information:
- Version of Rocket.Chat Server: 4.4.0
- Operating System: CentOS7
- Deployment Method: docker
- Number of Running Instances: 12
- DB Replicaset Oplog: Enabled
- NodeJS Version: 14.18.2
- MongoDB Version: 4.2.17
Client Setup Information
- Desktop App or Browser Version: 3.5.7
- Operating System: Windows 10
Additional context
I don't know about specific impact for users from that errors, I guess users get some errors when they not expect to get them, for example when creating some chats.
Relevant logs:
{"level":50,"time":"2022-01-14T05:05:34.809Z","pid":9,"hostname":"d7d6e2fc85a8","name":"System","msg":"Exception while invoking method getRoomByTypeAndName 'Invalid room [error-invalid-room]'"}
{"level":50,"time":"2022-01-14T05:05:34.823Z","pid":9,"hostname":"d7d6e2fc85a8","name":"System","msg":"Exception while invoking method getRoomByTypeAndName 'Invalid room [error-invalid-room]'"}
{"level":50,"time":"2022-01-14T05:05:34.896Z","pid":9,"hostname":"d7d6e2fc85a8","name":"System","msg":"Exception while invoking method createDirectMessage 'E11000 duplicate key error collection: rocketchat.rocketchat_room index: _id_ dup key: { _id: \"YPevH7EkhFbCwTRD4ZZbxSB4gdT4k7fz7p\" }'"}
{"level":50,"time":"2022-01-14T05:05:34.941Z","pid":9,"hostname":"d7d6e2fc85a8","name":"System","msg":"Exception while invoking method getRoomByTypeAndName 'Invalid room [error-invalid-room]'"}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported createDirectMessage and getRoomByTypeAndName methods, then reproduce the E11000 events using the supplied server, deployment, replica-set, and multi-instance details. Trace how the duplicate room condition produces Invalid room errors; done means normal room creation and lookup without duplicate-key or related invalid-room errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, typescript
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100