Commit 4d88848
fix: always attach goroutine profile on stuck waitgroup detection (#4185)
singleflight.Group.Do returns shared=true for ALL callers when multiple
hit concurrently — including the original. The previous !profileShared
gate meant no caller ever stored the profile in the thundering-herd
scenario, which is exactly when the diagnostic data is most needed.
Removed the shared return value from captureGoroutineSummary since the
singleflight still deduplicates the expensive pprof capture itself.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk diagnostic change that only affects stuck waitgroup
tracing/logging paths, with a small potential increase in trace payload
size.
>
> **Overview**
> When `ExecuteQuery` detects a cancelled context and the adapter
waitgroup remains stuck, the `waitgroup.stuck` span event now **always**
includes the compacted goroutine pprof summary.
>
> This simplifies `captureGoroutineSummary` to return only the shared
profile string (still singleflight-deduped) and removes the prior
conditional that could omit the profile under concurrent callers; it
also makes minor formatting/cleanup changes (e.g., grouping atomic
counters).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ddd2cddfb4d1c66003535bc296c4b11e9cb377e1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
GitOrigin-RevId: db976f32f2cae318e5f8f5637e850e3de21b94401 parent 749afad commit 4d88848
1 file changed
Lines changed: 12 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
199 | 198 | | |
200 | 199 | | |
201 | 200 | | |
202 | | - | |
| 201 | + | |
203 | 202 | | |
204 | 203 | | |
205 | | - | |
206 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
| |||
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
345 | | - | |
| 346 | + | |
346 | 347 | | |
347 | | - | |
| 348 | + | |
348 | 349 | | |
349 | 350 | | |
350 | 351 | | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
| 352 | + | |
| 353 | + | |
356 | 354 | | |
357 | 355 | | |
358 | 356 | | |
| |||
0 commit comments