canonical / canonical/multipass
Using heredoc input with `exec` can consume much CPU time
- Dominant language
- C++
- Stars
- 9.2k
- Forks
- 828
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 44
Description
In the conversation in #1217, it was brought up that when using heredoc input will consume much CPU time. Here is the example:
```
$ time multipass exec node1 -- /bin/bash << EOF
curl -fsSL https://get.docker.com | sh
EOF
...
real 6m21.030s
user 2m19.718s
sys 3m49.603s
```
I did some initial debugging and found the `libssh` is passing the `curl | sh` output to the host `multipass` client and then the client is passing that back into the instance's `bash` command. Two extra and unnecessary encrypt/decrypt trips between the host and instance as the output should really stay in the instance and be passed directly to bash.
Contributor guide
Research direction
Reproduce the heredoc command from the issue and trace the exec path around libssh, focusing on why command output is passed through the host client. Confirm the completed change by showing that heredoc input remains in the instance and that the unnecessary host-side encryption and decryption trips, CPU use, and elapsed time are reduced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100