go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

mongo logDuration, context canceled occurred sometimes.

Open tqqya opened this issue 1 year ago • 6 comments
trafficstars

Describe the bug image image image

版本gz1.6.0,go1.20

tqqya avatar Dec 28 '23 08:12 tqqya

任何增删改查都有概率触发这个错误

tqqya avatar Dec 28 '23 08:12 tqqya

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Any addition, deletion, modification or query may trigger this error.

Issues-translate-bot avatar Dec 28 '23 08:12 Issues-translate-bot

The go-zero documentation regarding the setting of the MongoDB operation timeout. https://go-zero.dev/docs/tutorials/mongo/connection

codeErrorSleep avatar Jan 03 '24 02:01 codeErrorSleep

@codeErrorSleep 貌似不生效呢,我检查了传入mongo的context,超时时间是跟着gozero的设置走的,我这里设置了30s, 但是触发报错时,只用了100ms

tqqya avatar Jan 04 '24 01:01 tqqya

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@codeErrorSleep doesn't seem to take effect. I checked the context passed into mongo. The timeout follows the setting of gozero. I set it here to 30s. But when the error is triggered, it only takes 100ms.

Issues-translate-bot avatar Jan 04 '24 01:01 Issues-translate-bot

The clients might canceled the requests.

kevwan avatar Jan 13 '24 15:01 kevwan