Deleting a user doesn't delete rocketchat_subscription's for DM's
Rocket.Chat Version: 0.54.2 Running Instances: 1 DB Replicaset OpLog: Disabled Node Version: 4.8.1
I had the same problem like #1149.
I followed kalebwalton solution step to solve the problem.
use mydb db.users.find( {"username":"kwalton"} ) <-- just to make sure the user existed db.users.remove( {"username":"kwalton"} ) <-- deletes the user Then I re-logged in to Rocket.Chat and it worked. But I ran into another issue where I couldn't direct message someone, so I went back into mongo and: use mydb db.rocketchat_subscription.find({"name":"kwalton"}) <-- copied the rid value for the person and my conversation db.rocketchat_subscription.remove({"name":"kwalton"}) <-- deletes my subscriptions db.rocketchat_room.find({"_id":""}) <-- just to make sure the room exists db.rocketchat_room.remove({"_id":""}) <-- remove the room Also found any other rooms that matched the other person and I: db.rocketchat_room.find({"usernames" : [ "theotherperson", "kwalton" ]}) db.rocketchat_room.remove({"usernames" : [ "theotherperson", "kwalton" ]}) <-- removed all rooms between us, appeared to be a dupe in there causing trouble
But now I have an other problem.
Now it says "No user with username was found!" when trying to access the direct message.

need this to be fixed
Fixed this by deleting the subscriptions of the effected users in mongoDB. After that I had to restart the server and the users had to relogin.
How looks your mongodb-Query?
db.getCollection('rocketchat_subscription').find({ "name": "username1", $and: [ { "u.username": "username2" } ] }) db.getCollection('rocketchat_subscription').find({ "name": "username2", $and: [ { "u.username": "username1" } ] })
Bug is still here, i just observed a couple users with this issue, it's really time consuming for the server admin
0.56.0: Issue is there. Discovered it when trying to DM.
So I was playing with on my local VM and it seems that it works fine there, but there is a difference between my local VM and the bigger test bed, is that mine complains about how I don't have my MongoDB on ReplicaSet mode.
Error: Rocket.Chat requires oplog tailing when running in multiple instances
Please make sure your MongoDB is on ReplicaSet mode and MONGO_OPLOG_URL environment variable is defined correctly on the application server
Wonder if having it in ReplicaSet mode could be causing it not to work?
Well the first post said he didn't have ReplicaSet on.. So that that's probably not it. I did see a bunch of stuff about caching around the queries.
Same issue with deleted/recreated user.
Problem still exists with v0.57. :(
The provided solution is just a nasty workaround - shouldn't the problem still be fixed? I am not sure how to apply this at all. Is there some other way that does not involve messing with the datastore?
Exception while invoking method 'createDirectMessage' MongoError:
E11000 duplicate key error collection: parties.rocketchat_subscription index: u._id_1_name_1_t_1_code_1 dup key:
{ : "RWmMv7vkye3Kb7Ao8", : "fmuecke", : "d", : null }
at Object.Future.wait (/snap/rocketchat-server/829/node_modules/fibers/future.js:449:15)
Hi,
I removed the user account, every subscription and then restarted everything. Same problem. I can't dm the user. Anything else I can do?
I'm using 0.57.2
Any progress on this?
Same problem here :\
Any progress on this?
Same Here, below error on 0.58.0 on Docker with Oplog enabled:
Exception while invoking method 'createDirectMessage' MongoError: E11000 duplicate key error collection: rocketchat.rocketchat_subscription index: u._id_1_name_1_t_1_code_1 dup key: { : "GbFCZzXFtPbp9JEA8", : "XXXXX", : "d", : null }
at [object Object].<anonymous> (packages/meteor.js:213:24)
at [object Object].MongoConnection.(anonymous function) [as update] (/app/bundle/programs/server/packages/mongo.js:835:49)
at Object.<anonymous> (packages/matb33_collection-hooks.js:504:27)
at Object.collection.(anonymous function) [as update] (packages/matb33_collection-hooks.js:146:21)
at [object Object].update (/app/bundle/programs/server/packages/mongo.js:3917:31)
at ModelsBaseDb.update (/app/bundle/programs/server/packages/rocketchat_lib.js:10914:32)
at ModelsBaseDb.upsert (/app/bundle/programs/server/packages/rocketchat_lib.js:10989:16)
at ModelSubscriptions.upsert (/app/bundle/programs/server/packages/rocketchat_lib.js:4486:36)
at [object Object].Meteor.methods.createDirectMessage (/app/bundle/programs/server/app/app.js:6585:35)
at [object Object].methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)
at [object Object].methodsMap.(anonymous function) (/app/bundle/programs/server/packages/rocketchat_lib.js:1110:26)
at maybeAuditArgumentChecks (/app/bundle/programs/server/packages/ddp-server.js:1858:12)
at /app/bundle/programs/server/packages/ddp-server.js:904:20
at [object Object]._.extend.withValue (packages/meteor.js:1126:17)
at /app/bundle/programs/server/packages/ddp-server.js:903:47
at [object Object]._.extend.withValue (packages/meteor.js:1126:17)
at /app/bundle/programs/server/packages/ddp-server.js:902:46
at [object Object]._.extend.protocol_handlers.method (/app/bundle/programs/server/packages/ddp-server.js:875:21)
at /app/bundle/programs/server/packages/ddp-server.js:754:85
- - - - -
at Function.MongoError.create (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/error.js:31:11)
at toError (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:114:22)
at /app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/collection.js:1049:67
at /app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:455:18
at nextTickCallbackWith0Args (node.js:489:9)
at process._tickDomainCallback (node.js:459:13)```
Same problem here, a user has been deleted and then created again using custom Oauth (IdentityServer) login implementation. Direct chat to this username throws "username not found".
[34mI20170920-10:01:21.730(0) Exception while invoking method 'createDirectMessage' MongoError: E11000 duplicate key error index: rocketchat.rocketchat_subscription.$u._id_1_name_1_t_1_code_1 dup key: { : "W9TGtB4KCYxzfj3hR", : "Malou.Runnemo", : "d", : null } at Object.Future.wait (/opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:449:15) at [object Object].<anonymous> (packages/meteor.js:213:24) at [object Object].MongoConnection.(anonymous function) [as update] (/opt/Rocket.Chat/programs/server/packages/mongo.js:836:49) at Object.<anonymous> (packages/matb33_collection-hooks.js:504:27) at Object.collection.(anonymous function) [as update] (packages/matb33_collection-hooks.js:146:21) at [object Object].update (/opt/Rocket.Chat/programs/server/packages/mongo.js:3899:31) at ModelsBaseDb.update (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:10647:32) at ModelsBaseDb.upsert (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:10722:16) at ModelSubscriptions.upsert (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:4283:36) at [object Object].Meteor.methods.createDirectMessage (/opt/Rocket.Chat/programs/server/app/app.js:6506:35) at [object Object].methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30) at [object Object].methodsMap.(anonymous function) (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:1028:26) at maybeAuditArgumentChecks (/opt/Rocket.Chat/programs/server/packages/ddp-server.js:1823:12) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:905:20 at [object Object]._.extend.withValue (packages/meteor.js:1122:17) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:904:41 at [object Object]._.extend.withValue (packages/meteor.js:1122:17) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:903:46 at [object Object]._.extend.protocol_handlers.method (/opt/Rocket.Chat/programs/server/packages/ddp-server.js:876:21) at /opt/Rocket.Chat/programs/server/packages/ddp-server.js:755:85 - - - - - at Function.MongoError.create (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/error.js:31:11) at toError (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:114:22) at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/collection.js:1049:67 at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:455:18 at nextTickCallbackWith0Args (node.js:420:9) at process._tickDomainCallback (node.js:390:13)
I am seeing the same issue as well. Thanks.
Is anything gonna be done to solve this? I've had a conversation that I'm unable to delete/hide, for months now, because before the user was deleted, he sent me one message. That means that I am now stuck with "steve.houston [1]" in my list of Direct Messages. There is no way for me, through the UI, to hide that room, because the "hide room" button is where the [1] currently is. It also means I ALWAYS have a [1] on my favicon on the tabs.
Present the issue on version 0.59.3. We have recreated a user and we noticed this issue.
@rodrigok Maybe a cleanup/verify database script would be helpfull?
@rodrigok bringing this to your attention as there seems to be a continued issue and I've seen talk in the #dev channel on open.rocket.chat about this issue.
FYI: you can manually delete the affected subscription entries from the mongodb, e.g. (no guarantees):
start the mongo shell (e.g. enter your docker-mongo container and execute mongo)
- use the rocketchat db use rocketchat
- find entries for the given user: db.rocketchat_subscription.find( { "name" : "USERNAME_OF_THE_DELETED_USER" } )
- if you are satisfied with your findings, delete them: db.rocketchat_subscription.deleteMany( { "name" : "USERNAME_OF_THE_DELETED_USER" } )
Edit: Unfortunatly it does not work with rocketchat clients, they seem to access another dead database entry :( Edit2: completly deleting the rocketchat+ client directory (with all local databases, etc) makes the RC+ client work again with formerly broken users
Hopefully the deletion of subscriptions will be fixed within rocketchat, as well as a 'sanitize database' function added :)