Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

em-ssh-shell fails to start shell without error #5

Open
darkskiez opened this issue Apr 24, 2012 · 6 comments
Open

em-ssh-shell fails to start shell without error #5

darkskiez opened this issue Apr 24, 2012 · 6 comments

Comments

@darkskiez
Copy link

Not sure whats happening yet, but my block inside EM::Ssh::Shell.new never gets evaluated, and no errors are raised

I can simulate this easily by connecting 50 times concurrently

@gruis
Copy link
Owner

gruis commented Apr 24, 2012

Can you post some example code please?

Sent from my iPhone

On 2012/04/24, at 19:18, Mark [email protected] wrote:

Not sure whats happening yet, but my block inside EM::Ssh::Shell.new never gets evaluated, and no errors are raised

I can simulate this easily by connecting 50 times concurrently


Reply to this email directly or view it on GitHub:
#5

@darkskiez
Copy link
Author

EM.run {
  EM.error_handler do |e| 
    puts " **** ERROR #{e.message}"
    puts e.backtrace.join "\n" 
  end
  started=0

  (1..30).each do
    EM::Ssh::Shell.new("localhost", "emtest", "emdemo") do |shell|
      started+=1    
      shell.on(:error) do |e|
        puts "Shell error :( #{e}"
      end
      shell.on(:closed) do |e|
        puts "Shell close :( #{e}"
      end
    end
  end

  EventMachine::PeriodicTimer.new(1) do
    puts "We have #{started} connections"
  end
}

On my machine stared goes to 10, but never get any exceptions or errors.

@darkskiez
Copy link
Author

I found the reason for the 10 limit is the sshd_config default for MaxStartups is 10
but it doesn't explain the lack of errors.

@seryl
Copy link

seryl commented Sep 21, 2012

I'd put my money on this actually being the thread pool in EM (I believe it defaults to 20)...

Also, opening 30+ requests is quite inefficient, I'd suggest looking into using EM's work and request pooling:

https://github.com/eventmachine/eventmachine/blob/master/lib/em/pool.rb#L9-38

@seryl
Copy link

seryl commented Sep 21, 2012

root 2106 1 0 Aug13 ? 00:00:28 /usr/sbin/sshd
root 19326 2106 0 11:02 ? 00:00:00 sshd: root@pts/0
root 24137 2106 0 18:01 ? 00:00:00 sshd: root@pts/1
root 24154 2106 0 18:01 ? 00:00:00 sshd: root@pts/2
root 24155 2106 0 18:01 ? 00:00:00 sshd: root@pts/3
root 24156 2106 0 18:01 ? 00:00:00 sshd: root@pts/4
root 24157 2106 0 18:01 ? 00:00:00 sshd: root@pts/5
root 24158 2106 0 18:01 ? 00:00:00 sshd: root@pts/6
root 24159 2106 0 18:01 ? 00:00:00 sshd: root@pts/7
root 24160 2106 0 18:01 ? 00:00:00 sshd: root@pts/9
root 24161 2106 0 18:01 ? 00:00:00 sshd: root@pts/8
root 24162 2106 0 18:01 ? 00:00:00 sshd: root@pts/10
root 24163 2106 0 18:01 ? 00:00:00 sshd: root@pts/11
root 24305 24139 0 18:01 pts/1 00:00:00 grep ssh
[root ~]# ps -ef | grep ssh
root 2106 1 0 Aug13 ? 00:00:28 /usr/sbin/sshd
root 19326 2106 0 11:02 ? 00:00:00 sshd: root@pts/0
root 24137 2106 0 18:01 ? 00:00:00 sshd: root@pts/1
root 24307 24139 0 18:01 pts/1 00:00:00 grep ssh

I was incorrect. Tested the pool, not the case.

It's the max_startups as described above.

However, this still should be handled in a work queue, 10 simultaneous connections is plenty.

@kt97679
Copy link
Collaborator

kt97679 commented Jul 22, 2018

Folks, do you still see this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants