goroutine
已收录文章:3篇
-
Golang · Go问答 | 2天前 | goroutine · HTTP · Context · 超时控制 · Go问答 · WithTimeout Go问答 context取消 QueryContext HTTP请求取消 goroutine退出Go HTTP 请求断开后,r.Context() 会收到取消信号,但服务端慢任务不会凭空停止。只有把 context 继续传给数据库、下游 HTTP 调用、消息消费和 goroutine,取消与超时才会真正变成资源释放动作。120 收藏
-
Golang · Go问答 | 2天前 | goroutine · pprof · Go问答 · 线上排查 · 性能调优 · pprof goroutine泄漏 服务告警 Go问答 context取消 Go线上排查Go 服务里 goroutine 数上涨不一定就是泄漏,关键要看是否持续不回落、相同栈是否反复堆积、请求结束后资源是否仍被占用。用 pprof 连续快照、堆栈对比和小流量验证,可以把判断和处理做得更稳。374 收藏
-
Golang · Go问答 | 2天前 | goroutine · Context · 超时控制 · Go问答 · 协程泄漏 · Go Goroutine 超时控制 context.WithTimeout 取消信号 协程泄漏 ctx.Donecontext.WithTimeout 只会在到期后关闭 Done 通道并返回取消原因,不会直接停掉 goroutine。Go 代码要把 ctx 传进阻塞调用,并在 select、循环和清理逻辑里主动响应取消信号。147 收藏