Bug 334 - SSH hangs when run via a cronjob (ssh2)
Summary: SSH hangs when run via a cronjob (ssh2)
Status: CLOSED WORKSFORME
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: -current
Hardware: ix86 Linux
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-04 08:08 AEST by Eric Garff
Modified: 2004-04-14 12:24 AEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Garff 2002-07-04 08:08:43 AEST
SSH hangs upon exit when running from a cronjob.  Server only allows SSH2 (does
not appear to have the same problem when using Protocol 1).

Redhat 6.2
Hardware independant.
Using OpenSSL 0.9.5a
configure line:
	./configure  --sysconfdir=/etc --with-tcp-wrappers --without-pam
--with-ssl-dir=/usr/local/src/openssl-0.9.5a --with-md5-passwords

The application is to execute remote code on another server via "passwordless"
ssh.  Keys generated are rsa.  When run manually (outside cron), executes and
exits normally.
Comment 1 Gray Watson 2002-12-06 08:58:00 AEDT
I will second this.  It seems to just hang after a while even though both the
server and the client are configured with KeepAlive enabled.

It also looks to both sides like the connection is still open.  The forwarded
ports are still in netstat output but they do not pass any information.

I'm turning off -N to see if that helps and moving to my own keepalive login
shell.  We'll see if that works.
Comment 2 Gray Watson 2002-12-06 08:59:59 AEDT
Ooops.  I'm running:

client on Linux RH7.X: OpenSSH_3.0.2p1, SSH protocols 1.5/2.0, OpenSSL 0x0090602f
server on FreeBSD 4.5: OpenSSH_3.0.2p1
Comment 3 Damien Miller 2002-12-06 11:05:03 AEDT
Please see if you can reproduce with the latest version
Comment 4 Darren Tucker 2003-05-04 22:18:48 AEST
5 months no reply == closed bug
Comment 5 Eric Garff 2003-07-09 08:00:52 AEST
I apologize I didn't not see the request for more testing.  

We have tried this very recently with 3.6.1p2 and see the same issue.
Comment 6 Darren Tucker 2003-07-09 10:15:54 AEST
Does the same thing happen if you run from the command line with nohup?

You can also use strace/truss or equivalent to see what it's trying to do when 
it hangs.  Make sure the cron job will take a while (add some sleeps if you have 
to) then wait until the cron job starts, find out ssh's pid and use "strace -p 
[pid]" to attach to the process.  Once you have the results, add the last 100 
lines or so as an attachment to this bug.

Also, the commands at the other end of the pipe might behave differently when 
they don't have a pty.  Try adding "-t" to ssh's command line to force the 
server to allocate one.
Comment 7 Darren Tucker 2003-08-26 17:44:45 AEST
No reply == no bug (again!)
Comment 8 Damien Miller 2004-04-14 12:24:18 AEST
Mass change of RESOLVED bugs to CLOSED