Commit 4effb4b
committed
fix: per-stage CLI runner deadlocked on output larger than the pipe buffer (issue #4)
The per-stage DuckDB runner spawned the CLI with stdout/stderr piped, then
polled try_wait() to completion and only read the output via
wait_with_output() AFTER the process exited. A child process's output pipe
has a fixed OS buffer (~64 KiB on Windows); once the CLI's result exceeded
it, DuckDB blocked writing stdout while the engine blocked waiting for exit.
Permanent deadlock.
This bit the per-stage path's node preview: `SELECT * FROM <node> LIMIT 100`.
For a wide table (a 36-column Oracle date dimension serialized to ~128 KiB of
JSON) it hung every run, on the SOURCE node's preview, before the sink stage
ever executed. Symptoms matched exactly: the source row count was correct
(COUNT(*) is tiny, well under the buffer), the sink produced no file (never
reached), and the temp DB was left on disk (the run never reached cleanup).
SQL Server "worked" only because that table was narrow enough to stay under
the buffer - it was table-width-specific, not Oracle-specific. The batched
(pure-SQL) path was immune because it already drains stdout on a thread.
The runner now drains stdout and stderr on dedicated threads while the
process runs, so any result size completes. Cancellation still kills the
child and joins the readers. Adds a regression test: a wide CSV whose
100-row preview exceeds the pipe buffer, forced onto the per-stage path,
must complete.1 parent cd68f84 commit 4effb4b
2 files changed
Lines changed: 95 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
169 | 199 | | |
170 | | - | |
| 200 | + | |
171 | 201 | | |
172 | 202 | | |
173 | 203 | | |
174 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
175 | 209 | | |
176 | 210 | | |
177 | 211 | | |
178 | 212 | | |
179 | 213 | | |
180 | 214 | | |
181 | | - | |
| 215 | + | |
182 | 216 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
188 | 221 | | |
189 | | - | |
| 222 | + | |
190 | 223 | | |
191 | 224 | | |
192 | 225 | | |
193 | 226 | | |
194 | 227 | | |
195 | 228 | | |
196 | | - | |
| 229 | + | |
197 | 230 | | |
198 | 231 | | |
199 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
240 | 292 | | |
241 | 293 | | |
242 | 294 | | |
| |||
0 commit comments