Commit 18ceb3e
authored
Fix multi-repo RPC deadlock via stderr redirect and dedicated GetObject pool (#7036)
Two independent deadlocks prevented `mod run` from completing across
multiple C# repositories:
1. **Stderr pipe buffer deadlock**: On macOS the kernel pipe buffer for
stderr is 64KB. When the dotnet subprocess writes enough to stderr to
fill this buffer, it blocks on the next write(), which deadlocks any
in-progress RPC response on stdout. Fix: redirect stderr at the OS
level via ProcessBuilder.redirectError() — to the log file when
configured, or to /dev/null otherwise. This eliminates the pipe
entirely so the subprocess never blocks on stderr.
2. **GetObject thread pool starvation**: GetObject.Handler submitted
background tree traversal tasks to ForkJoinPool.commonPool(), which
is the same pool used by the CLI for repo-level fork-join work. When
repo tasks saturated the pool (blocked on semaphores or waiting for
RPC responses), GetObject producers couldn't start, deadlocking the
batch protocol. Fix: use a dedicated cached thread pool for tree
traversal so GetObject producers are never starved by unrelated work.1 parent e5d7c93 commit 18ceb3e
5 files changed
Lines changed: 24 additions & 29 deletions
File tree
- rewrite-core/src/main/java/org/openrewrite/rpc
- request
- rewrite-csharp/src/main/java/org/openrewrite/csharp/rpc
- rewrite-javascript/src/main/java/org/openrewrite/javascript/rpc
- rewrite-python/src/main/java/org/openrewrite/python/rpc
Lines changed: 13 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
| |||
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
66 | | - | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| |||
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
| |||
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 112 | | |
118 | 113 | | |
119 | 114 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 115 | | |
129 | 116 | | |
130 | 117 | | |
| |||
135 | 122 | | |
136 | 123 | | |
137 | 124 | | |
138 | | - | |
139 | 125 | | |
140 | 126 | | |
141 | 127 | | |
142 | | - | |
143 | | - | |
| 128 | + | |
| 129 | + | |
144 | 130 | | |
145 | 131 | | |
146 | 132 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
77 | 83 | | |
78 | 84 | | |
79 | 85 | | |
80 | | - | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
| 584 | + | |
584 | 585 | | |
585 | 586 | | |
586 | 587 | | |
| |||
0 commit comments