Commit 62b41a8
committed
fix(socket_mode): shut down current_session_runner in close()
`SocketModeClient` starts three `IntervalRunner` threads in
`__init__`: `current_session_runner` (interval 0.1 s),
`current_app_monitor` (interval = `ping_interval`, default 5 s) and
`message_processor` (interval 0.001 s). `close()` shut down two of
them but not `current_session_runner`, so every instance leaked one
thread running a 100 ms loop.
For long-running watchers that recreate the client occasionally (e.g.
after a transient disconnect detected via `is_connected()`), the
leaked threads accumulate and combine with the live instance's 1 ms
`message_processor` loop to drive CPU usage up. The same client
instances also fail to release their threads under normal lifetime
management.
Adds a guarded `current_session_runner.shutdown()` call alongside the
existing two, plus a regression test verifying that all three runners
exit after `close()`.
Closes #18731 parent beecde2 commit 62b41a8
2 files changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
51 | 69 | | |
52 | 70 | | |
53 | 71 | | |
| |||
0 commit comments