leocook commented on issue #18201:
URL: 
https://github.com/apache/dolphinscheduler/issues/18201#issuecomment-4359845780

   Hi, I looked into this issue and found some details that might help.
   
   **Root Cause**
   
   This is a regression introduced by commit `5c5b44c7d0` (PR #17800, merged 
2026-01-12). That PR changed how the SSH channel output is read — it switched 
from `channel.setOut(ByteArrayOutputStream)` to `channel.getInvertedOut()`. The 
problem is `getInvertedOut()` returns null before `channel.open()` completes 
the SSH handshake, so the `InputStreamReader` constructor blows up with NPE.
   
   **Two bugs, same commit**
   
   Actually there are two failure modes here:
   
   1. **NPE** (what you're seeing) — `getInvertedOut()` is called before 
`open()`, so it returns null.
   
   2. **"Pipe closed after 0 cycles"** — even if you fix the NPE by moving 
`getInvertedOut()` after `open()`, MINA SSHD's `ChannelPipedInputStream` throws 
an IOException when a command produces no output (e.g. `mkdir`). Standard Java 
`PipedInputStream` would just return -1 in that case, but MINA SSHD treats 
"pipe closed without any data ever written" as an error.
   
   Both are triggered on every REMOTESHELL task since 
`runRemoteAndProcessLines()` is the common entry point for all remote commands.
   
   **Fix direction**
   
   The safe fix is to revert to the `setOut(ByteArrayOutputStream)` approach 
(wait for command to finish, then read the collected output), while keeping the 
line-by-line processing improvement from that PR. I've verified this works 
locally.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to