You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-ups from the review of #2839 (which fixed the pipe deadlock by draining stdout/stderr concurrently with waitFor):
Bound memory while draining, not after.maxOutputBytes is applied post-hoc to the assembled string, so a huge output can OOM before truncation runs. Cap buf.write once the buffer hits maxOutputBytes, keep reading-and-discarding so the OS pipe stays drained, and mark the result truncated when bytes were dropped.
Align reader teardown with ShellCommandTool.join(timeout) may return while the drainer thread is still alive, and ByteArrayOutputStream is not thread-safe, so toString() can race with write. Prefer Future.get(timeout) + cancel(true) (discarding the untrusted buffer), or interrupt the drainer when it is still alive after join.
Follow-ups from the review of #2839 (which fixed the pipe deadlock by draining stdout/stderr concurrently with
waitFor):Bound memory while draining, not after.
maxOutputBytesis applied post-hoc to the assembled string, so a huge output can OOM before truncation runs. Capbuf.writeonce the buffer hitsmaxOutputBytes, keep reading-and-discarding so the OS pipe stays drained, and mark the resulttruncatedwhen bytes were dropped.Align reader teardown with
ShellCommandTool.join(timeout)may return while the drainer thread is still alive, andByteArrayOutputStreamis not thread-safe, sotoString()can race withwrite. PreferFuture.get(timeout)+cancel(true)(discarding the untrusted buffer), or interrupt the drainer when it is still alive after join.Add a stderr / dual-stream regression test alongside the stdout one added in fix(harness): prevent pipe deadlock in LocalFilesystemWithShell.execute #2839.
Happy to send the PR(s) once #2839 is merged.