Commit 070c338
authored
Interruption problems in
* frollapply: let the interrupt continue
Instead of calling invokeRestart("abort") in the interrupt handler,
return from it. This continues the dispatch of the interrupt and lets an
outer handler catch it:
tryCatch(
frollapply(1:1e6, 1, \(.) { Sys.sleep(ret <- sum(.)); ret}),
interrupt = \(e) 'interrupted'
)
^C[1] "interrupted"
With invokeRestart("abort"), the interrupt cannot be handled further.
* frollapply: wait for terminated parallel processes
While handling an interrupt, ask mccollect() to wait for the child
process to exit (with a warning) in order to avoid producing zombies.
Otherwise a process that is too slow to react to SIGTERM will remain a
zombie until the parent process exits.
* Use waitid() to choose processes to terminate
Since the PIDs of our worker processes could have been reused, first
test them using waitid(NOWAIT) to make sure they are still ours.
* Interruption handling is not coveredfrollapply (#7428)1 parent b0b8b23 commit 070c338
4 files changed
+29
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
399 | | - | |
| 398 | + | |
| 399 | + | |
400 | 400 | | |
401 | | - | |
402 | 401 | | |
| 402 | + | |
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
672 | 676 | | |
673 | 677 | | |
674 | 678 | | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
0 commit comments