Repository navigation
Commit 16b50ac
committed
fix: Wait out the cancel-token gap from any thread but the action's own
A third review found that a cancel straight after an action started
could still be lost under load. The crate reports an action Running,
then logs its banner and installs its cancel token; logging needs the
GIL and runs every Python logging handler, so the gap is as long as the
action thread waits for the GIL, seconds when other Python threads are
busy. The previous commit gave up after 2 s everywhere. The binding now
records which thread runs the current action, and only a cancel from
that thread (a logging handler) gives up after 2 s; from any other
thread it waits, with the GIL released, until the token is installed or
the session is back, which the action thread does without help. Pinned
in a fresh interpreter with a logging handler that takes 2.5 s.
Also from the review:
- If an action thread ever ended without telling its caller the
outcome, the caller would have waited for ever. A guard held by the
thread now drops the call's sender, only if the slot still holds that
call, so the caller wakes up.
- Every refusal test now checks state, action_status and
environments_entered, including the busy, ValueError and
clear_ending_only cases. The fresh-interpreter tests' timeouts are
under pytest's 30 s limit.
- The sessions spec's constructor block matches the binding, it
documents the binding's own "Cannot cancel: the action has not
started yet" and WindowsSessionUser's RuntimeError, and its new
paragraphs are rewrapped. The quality report lists the
WindowsSessionUser change.
Signed-off-by: Mark Wiebe <399551+mwiebe@users.noreply.github.com>1 parent 8077e87 commit 16b50ac
5 files changed
Lines changed: 180 additions & 70 deletions
File tree
- reports
- rust-bindings/src/sessions
- specs
- src/openjd
- test/openjd/sessions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
375 | 376 | | |
376 | 377 | | |
377 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
| |||
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
209 | 244 | | |
210 | 245 | | |
211 | 246 | | |
| |||
376 | 411 | | |
377 | 412 | | |
378 | 413 | | |
| 414 | + | |
| 415 | + | |
379 | 416 | | |
380 | 417 | | |
381 | 418 | | |
| |||
422 | 459 | | |
423 | 460 | | |
424 | 461 | | |
| 462 | + | |
425 | 463 | | |
| 464 | + | |
426 | 465 | | |
427 | 466 | | |
428 | 467 | | |
| |||
435 | 474 | | |
436 | 475 | | |
437 | 476 | | |
| 477 | + | |
438 | 478 | | |
439 | 479 | | |
440 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
441 | 487 | | |
442 | 488 | | |
443 | 489 | | |
| |||
459 | 505 | | |
460 | 506 | | |
461 | 507 | | |
462 | | - | |
463 | | - | |
464 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
465 | 512 | | |
466 | 513 | | |
467 | 514 | | |
| |||
586 | 633 | | |
587 | 634 | | |
588 | 635 | | |
| 636 | + | |
589 | 637 | | |
590 | 638 | | |
591 | 639 | | |
| |||
851 | 899 | | |
852 | 900 | | |
853 | 901 | | |
854 | | - | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
855 | 906 | | |
856 | 907 | | |
857 | 908 | | |
| |||
866 | 917 | | |
867 | 918 | | |
868 | 919 | | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
877 | 930 | | |
878 | | - | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
879 | 934 | | |
880 | 935 | | |
881 | 936 | | |
| |||
902 | 957 | | |
903 | 958 | | |
904 | 959 | | |
905 | | - | |
| 960 | + | |
906 | 961 | | |
907 | 962 | | |
908 | 963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | 103 | | |
| 104 | + | |
106 | 105 | | |
107 | 106 | | |
108 | | - | |
109 | | - | |
| 107 | + | |
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
| |||
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
230 | 235 | | |
231 | 236 | | |
232 | 237 | | |
233 | 238 | | |
234 | 239 | | |
235 | 240 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
| |||
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
267 | 276 | | |
268 | 277 | | |
269 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2303 | 2303 | | |
2304 | 2304 | | |
2305 | 2305 | | |
2306 | | - | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
2307 | 2310 | | |
2308 | 2311 | | |
2309 | 2312 | | |
| |||
0 commit comments