Commit c2a2a07
Stop the Windows liveness check from killing R sessions
ClaudeR 0.13.2. cleanup_stale_discovery_files() probed a recorded pid
with tools::pskill(pid, signal = 0). On Unix that maps to kill(pid, 0)
and is a safe existence test, which is what the comment claimed. On
Windows it is not: ?tools::pskill states only SIGINT and SIGTERM exist
there and that pskill always uses TerminateProcess. The probe therefore
terminated the session it was asking about, and because the kill
succeeded the file was judged live and left behind, so agents were then
routed to a dead port. It ran on every Start Server, so a Windows user
with two RStudio sessions killed one by starting the other.
New pid_is_alive() never signals on Windows; it asks tasklist, which
ships with the OS and needs no extra package. Unix keeps kill(pid, 0).
Also: write_discovery_file() overwrote the discovery file of a
different live session registered under the same name, leaving agents
with a stale port and a token that no longer matched. Port reuse was
already reported loudly; this was silent. It now warns and names the
conflicting pid and port.
R CMD check: Status OK.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 64ee723 commit c2a2a07
3 files changed
Lines changed: 41 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
68 | 81 | | |
69 | 82 | | |
70 | 83 | | |
| |||
74 | 87 | | |
75 | 88 | | |
76 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
77 | 114 | | |
78 | 115 | | |
79 | 116 | | |
80 | 117 | | |
81 | 118 | | |
82 | 119 | | |
83 | 120 | | |
84 | | - | |
85 | | - | |
86 | | - | |
| 121 | + | |
87 | 122 | | |
88 | 123 | | |
89 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
0 commit comments