FastGPT icon indicating copy to clipboard operation
FastGPT copied to clipboard

删除知识库时报错:WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.

Open Ethereal-sakura opened this issue 1 year ago • 5 comments

例行检查

  • [x] 我已确认目前没有类似 issue
  • [x] 我已完整查看过项目 README,以及项目文档
  • [x] 我使用了自己的 key,并确认我的 key 是可正常使用的
  • [x] 我理解并愿意跟进此 issue,协助测试和提供反馈
  • [x] 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

你的版本

  • [ ] 公有云版本
  • [x] 私有部署版本

问题描述 删除知识库时报错,logs如下

[ERROR] 2024-03-12 13:23:12 response error: WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction. 
{
  message: 'WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.',
  stack: 'MongoServerError: WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.\n' +
    '    at w.onMessage (/app/projects/app/.next/server/chunks/25033.js:6:137587)\n' +
    '    at c.<anonymous> (/app/projects/app/.next/server/chunks/25033.js:6:135527)\n' +
    '    at c.emit (node:events:514:28)\n' +
    '    at e (/app/projects/app/.next/server/chunks/25033.js:6:159136)\n' +
    '    at c._write (/app/projects/app/.next/server/chunks/25033.js:6:159549)\n' +
    '    at writeOrBuffer (node:internal/streams/writable:392:12)\n' +
    '    at _write (node:internal/streams/writable:333:10)\n' +
    '    at Writable.write (node:internal/streams/writable:337:10)\n' +
    '    at Socket.ondata (node:internal/streams/readable:766:22)\n' +
    '    at Socket.emit (node:events:514:28)\n' +
    '    at addChunk (node:internal/streams/readable:324:12)\n' +
    '    at readableAddChunk (node:internal/streams/readable:297:9)\n' +
    '    at Readable.push (node:internal/streams/readable:234:10)\n' +
    '    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)'

相关截图 image

Ethereal-sakura avatar Mar 12 '24 13:03 Ethereal-sakura

看着是事务冲突。麻烦找找 mongodb 有没有相关错误日志。

c121914yu avatar Mar 13 '24 01:03 c121914yu

经过尝试找到了问题所在,我一个知识库里面有多个文件,只能一个一个删除,不能直接删除知识库,当知识库只有一个文件的时候,可以直接删除知识库

---原始邮件--- 发件人: @.> 发送时间: 2024年3月13日(周三) 上午9:15 收件人: @.>; 抄送: @.@.>; 主题: Re: [labring/FastGPT] 删除知识库时报错:WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction. (Issue #984)

看着是事务冲突。麻烦找找 mongodb 有没有相关错误日志。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Ethereal-sakura avatar Mar 13 '24 01:03 Ethereal-sakura

经过尝试找到了问题所在,我一个知识库里面有多个文件,只能一个一个删除,不能直接删除知识库,当知识库只有一个文件的时候,可以直接删除知识库

---原始邮件--- 发件人: @.> 发送时间: 2024年3月13日(周三) 上午9:15 收件人: @.>; 抄送: @.@.>; 主题: Re: [labring/FastGPT] 删除知识库时报错:WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction. (Issue #984)

看着是事务冲突。麻烦找找 mongodb 有没有相关错误日志。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

不是。我试了删除一个120个文件的知识库也可以。

c121914yu avatar Mar 13 '24 01:03 c121914yu

我当时用的是4.6.8,现在更新到4.6.9了,刚才试了一下确实可以直接删除多文件知识库了,不知道昨晚是为什么

Ethereal-sakura avatar Mar 13 '24 03:03 Ethereal-sakura

又遇到这个问题了,关于mongo的详细报错如下 背景:删除一个csv的知识库,数据总量23826 报错和标题一致

{"t":{"$date":"2024-04-07T08:07:53.017+00:00"},"s":"I", "c":"COMMAND", "id":51803, "ctx":"conn39","msg":"Slow query","attr":{"type":"command","ns":"fastgpt.$cmd","command":{"delete":"dataset.datas","deletes":[{"q":{"teamId":{"$oid":"65f0768d525042e3896ae316"},"collectionId":{"$in":[{"$oid":"65fe7761e2632ccbfad43f25"},{"$oid":"65fc4cfc1f4df0d1b4abe26c"}]}},"limit":0}],"ordered":true,"lsid":{"id":{"$uuid":"51ab4ebb-cdcf-4b3f-b4ad-f8d16559b2b7"}},"txnNumber":7,"autocommit":false,"startTransaction":true,"$clusterTime":{"clusterTime":{"$timestamp":{"t":1712477252,"i":1}},"signature":{"hash":{"$binary":{"base64":"/wMc+DIP2wCKYQDqeQ2f1A47pqY=","subType":"0"}},"keyId":7345484319248351238}},"$db":"fastgpt"},"numYields":0,"ok":0,"errMsg":"WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.","errName":"WriteConflict","errCode":112,"reslen":394,"locks":{"FeatureCompatibilityVersion":{"acquireCount":{"w":1}},"ReplicationStateTransition":{"acquireCount":{"w":3}},"Global":{"acquireCount":{"w":1}},"Database":{"acquireCount":{"w":1}},"Collection":{"acquireCount":{"w":1}},"Mutex":{"acquireCount":{"r":1}}},"flowControl":{"acquireCount":1,"timeAcquiringMicros":1},"readConcern":{"level":"local","provenance":"implicitDefault"},"storage":{},"remote":"172.25.0.4:40332","protocol":"op_msg","durationMillis":12508}}

fastgpt的日志如下

[ERROR] 2024-04-07 08:07:53 response error: WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction. 
{
  message: 'WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.',
  stack: 'MongoServerError: WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.\n' +
    '    at w.onMessage (/app/projects/app/.next/server/chunks/44015.js:6:137588)\n' +
    '    at c.<anonymous> (/app/projects/app/.next/server/chunks/44015.js:6:135528)\n' +
    '    at c.emit (node:events:514:28)\n' +
    '    at e (/app/projects/app/.next/server/chunks/44015.js:6:159137)\n' +
    '    at c._write (/app/projects/app/.next/server/chunks/44015.js:6:159550)\n' +
    '    at writeOrBuffer (node:internal/streams/writable:392:12)\n' +
    '    at _write (node:internal/streams/writable:333:10)\n' +
    '    at Writable.write (node:internal/streams/writable:337:10)\n' +
    '    at Socket.ondata (node:internal/streams/readable:766:22)\n' +
    '    at Socket.emit (node:events:514:28)\n' +
    '    at addChunk (node:internal/streams/readable:324:12)\n' +
    '    at readableAddChunk (node:internal/streams/readable:297:9)\n' +
    '    at Readable.push (node:internal/streams/readable:234:10)\n' +
    '    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)'
}

Ethereal-sakura avatar Apr 07 '24 08:04 Ethereal-sakura

印象中4.8修复了一个事务异步问题,应该和这个有关。目前没再遇到了。

c121914yu avatar May 28 '24 16:05 c121914yu