Ask Ubuntu Asked by user2149308 on December 15, 2021
I run the following code snippet:
#!/bin/bash
for i in $(seq 1 30); do
{
# output missing
#ssh root@MYHOST "echo hi"
# works
#bash -l -c "echo hi"
#echo hi
}&
done | wc -l
If I run ssh in parallel (30 times) and count the returning lines, I receive a random amount, always less than 30.
If I run echo hi
in parallel (or within its own shell), I receive all 30 lines.
What is going wrong here?
P.S.: I know that there are other tools for parallelization like parallel or pssh, but I try to understand the problem described here.
Thank you Doug Smythies, you provided the solution and thanks to you, too, pLumo, you posted the key error message.
I was in fact hitting MaxStartups 10:30:60
where 10 is "Number of unauthenticated connections before we start dropping"
(Quote: https://stackoverflow.com/questions/4812134/in-sshd-configuration-what-does-maxstartups-103060-mean)
The error message received when hitting that limit (which I threw away..) is
ssh_exchange_identification: Connection closed by remote host
.
Increasing the limit to 30 and restarting sshd resolves the issue.
Increasing MaxSessions
to 30 did not have any effect. Neither negatively when MaxSessions
was increased nor positively with the default settings for MaxSessions
.
Thank you again! Resolving this showed me that I didn't do anything fundamentally wrong when I used parallelization. Now I can focus on the tasks I really want to parallelize :)
Answered by user2149308 on December 15, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP