Title: bug: potential goroutine leak in `util.WaitFor` · Issue #210 · coder/agentapi · GitHub
Open Graph Title: bug: potential goroutine leak in `util.WaitFor` · Issue #210 · coder/agentapi
X Title: bug: potential goroutine leak in `util.WaitFor` · Issue #210 · coder/agentapi
Description: Within the Phase 1 util.WaitFor condition, the stability check does case <-util.After(c.cfg.Clock, 1*time.Second). util.After spawns a goroutine and uses an unbuffered channel; if the ctx.Done() branch wins that select, the goroutine can...
Open Graph Description: Within the Phase 1 util.WaitFor condition, the stability check does case <-util.After(c.cfg.Clock, 1*time.Second). util.After spawns a goroutine and uses an unbuffered channel; if the ctx.Done() br...
X Description: Within the Phase 1 util.WaitFor condition, the stability check does case <-util.After(c.cfg.Clock, 1*time.Second). util.After spawns a goroutine and uses an unbuffered channel; if the ctx.Done()...
Opengraph URL: https://github.com/coder/agentapi/issues/210
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: potential goroutine leak in `util.WaitFor`","articleBody":"Within the Phase 1 `util.WaitFor` condition, the stability check does `case \u003c-util.After(c.cfg.Clock, 1*time.Second)`. `util.After` spawns a goroutine and uses an unbuffered channel; if the `ctx.Done()` branch wins that select, the goroutine can block forever trying to send after the timer fires, leaking a goroutine per cancellation. Consider using an inline clock timer (`c.cfg.Clock.NewTimer`) and stopping/draining it on cancellation to avoid leaks and reduce per-iteration goroutine churn.\r\n\r\n_Originally posted by @Copilot in https://github.com/coder/agentapi/pull/208#discussion_r3016703805_\r\n ","author":{"url":"https://github.com/johnstcn","@type":"Person","name":"johnstcn"},"datePublished":"2026-03-31T16:49:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/210/agentapi/issues/210"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b875dd32-0a2d-077d-c450-7718fe5b1262 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8614:13657F:BB6ADB:1121C3B:6A4E2397 |
| html-safe-nonce | 1963dc096fd531891fe84fafd82fa235b3305fe1f1a31b0056f18fe9dc138f20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjE0OjEzNjU3RjpCQjZBREI6MTEyMUMzQjo2QTRFMjM5NyIsInZpc2l0b3JfaWQiOiI2NzM0MzkyNzU3Nzk0NTEzODE1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 064eb79ce50bbbe3402ead2225debde9c2618d2f089978aeb0e2466c97f56517 |
| hovercard-subject-tag | issue:4180742759 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/agentapi/210/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d3fd043c9e49524a015c0db0dbad46303d37abce07f06e30ecdb9e893d8cf9bc/coder/agentapi/issues/210 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d3fd043c9e49524a015c0db0dbad46303d37abce07f06e30ecdb9e893d8cf9bc/coder/agentapi/issues/210 |
| og:image:alt | Within the Phase 1 util.WaitFor condition, the stability check does case <-util.After(c.cfg.Clock, 1*time.Second). util.After spawns a goroutine and uses an unbuffered channel; if the ctx.Done() br... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johnstcn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/agentapi git https://github.com/coder/agentapi.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 961832048 |
| octolytics-dimension-repository_nwo | coder/agentapi |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 961832048 |
| octolytics-dimension-repository_network_root_nwo | coder/agentapi |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5fe497b4815fcce3df76c0e246faa739a82c3124 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width