[BUG] 邀请 user to group 在成员已承诺后返回 500 个—— CreateGroupChatConversation 中检查时插入的种族
作者: leooooy创建于 2026年8月14日更新于 2026年8月14日
标签bug
CreateGroupChatConversationinpkg/common/storage/controller/conversation.gois a check-then-insert:
existConversationUserIDs, err := c.conversationDB.FindUserID(ctx, userIDs, []string{conversationID}) // ① read
notExistUserIDs := stringutil.DifferenceString(userIDs, existConversationUserIDs) // ② diff
err = c.conversationDB.Create(ctx, conversations) // ③ insertCreateinpkg/common/storage/database/mgo/conversation.gois a plain
return mongoutil.InsertMany(ctx, c.coll, conversations)with no upsert, no $setOnInsert, and no mongo.IsDuplicateKeyError handling.
Between ① and ③ there is a window. When a concurrent path creates the same conversation document in that window, both sides see "does not exist" and both insert; the
内容来源: openimsdk/open-im-server