public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* ssh-agent doesn't die
@ 2019-09-27  0:34 Tim Adye
  2019-09-27  2:43 ` Norton Allen
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Tim Adye @ 2019-09-27  0:34 UTC (permalink / raw)
  To: cygwin

Hi,

I have noticed a (new?) problem with using ssh-agent to start a session, 
eg. with

   ssh-agent xterm &

When the xterm (or whatever) command completes, the ssh-agent process is 
still left running in the background. It should stop once its subprocess 
is done.

As a simple test example, consider:

/bin/ssh-agent /bin/sleep 10

While the sleep is still running, ps shows:

       PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
      1694    1693    1694       1576  ?          22534 00:01:10 
/usr/bin/ssh-agent
      1653       1    1653      11740  cons1      22534 00:00:37 
/usr/bin/bash
      1693    1653    1693       1552  cons1      22534 00:01:10 
/usr/bin/sleep

One oddity is that ssh-agent is listed as a subprocess of sleep, not the 
other way round. pstree shows this clearly:

?-+-bash---pstree
   `-bash---sleep---ssh-agent

Once the sleep finishes, ps shows:

       PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
      1694    1693    1694       1576  ?          22534 00:01:10 
/usr/bin/ssh-agent
      1653       1    1653      11740  cons1      22534 00:00:37 
/usr/bin/bash

ie. ssh-agent is still running, though its PPID no longer exists.

I'm using the latest release versions of cygwin and openssh:

Cygwin Package Information
Package              Version        Status
cygwin               3.0.7-1        OK
openssh              8.0p1-2        OK

with Windows 10 1803 (2019-09 update). I use Sophos AV 10.8 with HitmanPro.

Previously, I haven't had this problem: ssh-agent stopped when it's 
subprocess stopped. I updated from Cygwin 2.10-1 (and contemporaneous 
openssh) fairly recently, and it's possible the problem started then. Or 
it could have been a Windows minor update, AV update, or some other 
setting change I made. Sorry I couldn't pin it down further.

Is it just me that sees this, or could it be a bug in ssh-agent or Cygwin?

If it is just me, my first suspicion would be HitmanPro, which 
previously caused silent failures with an earlier version of Cygwin (I 
reported in cygwin-patches@cygwin.com, June 2018). That bug is fixed, 
but maybe this is something new. If we can rule out a more general 
Cygwin bug, I can ask my IT support to try disabling the HitmanPro to test.

Thanks,
Tim.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27  0:34 ssh-agent doesn't die Tim Adye
@ 2019-09-27  2:43 ` Norton Allen
  2019-09-27  5:38 ` Ken Brown
  2019-11-03 19:01 ` Corinna Vinschen
  2 siblings, 0 replies; 13+ messages in thread
From: Norton Allen @ 2019-09-27  2:43 UTC (permalink / raw)
  To: cygwin

On 9/26/2019 7:42 PM, Tim Adye wrote:
>
> Is it just me that sees this, or could it be a bug in ssh-agent or 
> Cygwin?

I see the same thing (and have never heard of HitmanPro)



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27  0:34 ssh-agent doesn't die Tim Adye
  2019-09-27  2:43 ` Norton Allen
@ 2019-09-27  5:38 ` Ken Brown
  2019-09-27 14:12   ` Norton Allen
  2019-11-03 19:01 ` Corinna Vinschen
  2 siblings, 1 reply; 13+ messages in thread
From: Ken Brown @ 2019-09-27  5:38 UTC (permalink / raw)
  To: cygwin

On 9/26/2019 7:42 PM, Tim Adye wrote:
> Hi,
> 
> I have noticed a (new?) problem with using ssh-agent to start a session, eg. with
> 
>    ssh-agent xterm &
> 
> When the xterm (or whatever) command completes, the ssh-agent process is still 
> left running in the background. It should stop once its subprocess is done.

This does seem like a bug...

> As a simple test example, consider:
> 
> /bin/ssh-agent /bin/sleep 10
> 
> While the sleep is still running, ps shows:
> 
>        PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>       1694    1693    1694       1576  ?          22534 00:01:10 /usr/bin/ssh-agent
>       1653       1    1653      11740  cons1      22534 00:00:37 /usr/bin/bash
>       1693    1653    1693       1552  cons1      22534 00:01:10 /usr/bin/sleep
> 
> One oddity is that ssh-agent is listed as a subprocess of sleep

...but this isn't a bug.  ssh-agent forks, and then the parent execs the command.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27  5:38 ` Ken Brown
@ 2019-09-27 14:12   ` Norton Allen
  2019-09-27 14:27     ` Ken Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Norton Allen @ 2019-09-27 14:12 UTC (permalink / raw)
  To: cygwin

On 9/26/2019 10:50 PM, Ken Brown wrote:
>
>> As a simple test example, consider:
>>
>> /bin/ssh-agent /bin/sleep 10
>>
>> While the sleep is still running, ps shows:
>>
>>         PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>>        1694    1693    1694       1576  ?          22534 00:01:10 /usr/bin/ssh-agent
>>        1653       1    1653      11740  cons1      22534 00:00:37 /usr/bin/bash
>>        1693    1653    1693       1552  cons1      22534 00:01:10 /usr/bin/sleep
>>
>> One oddity is that ssh-agent is listed as a subprocess of sleep
> ...but this isn't a bug.  ssh-agent forks, and then the parent execs the command.

With the salient difference presumably being that the exec is done in 
the parent instead of the child as usual?


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27 14:12   ` Norton Allen
@ 2019-09-27 14:27     ` Ken Brown
  2019-09-27 15:09       ` Vanda Vodkamilkevich
       [not found]       ` <185c5774-dd8b-5488-b818-4cec5a24bf2d@cornell.edu>
  0 siblings, 2 replies; 13+ messages in thread
From: Ken Brown @ 2019-09-27 14:27 UTC (permalink / raw)
  To: cygwin

On 9/27/2019 9:37 AM, Norton Allen wrote:
> On 9/26/2019 10:50 PM, Ken Brown wrote:
>>
>>> As a simple test example, consider:
>>>
>>> /bin/ssh-agent /bin/sleep 10
>>>
>>> While the sleep is still running, ps shows:
>>>
>>>         PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>>>        1694    1693    1694       1576  ?          22534 00:01:10 
>>> /usr/bin/ssh-agent
>>>        1653       1    1653      11740  cons1      22534 00:00:37 /usr/bin/bash
>>>        1693    1653    1693       1552  cons1      22534 00:01:10 /usr/bin/sleep
>>>
>>> One oddity is that ssh-agent is listed as a subprocess of sleep
>> ...but this isn't a bug.  ssh-agent forks, and then the parent execs the command.
> 
> With the salient difference presumably being that the exec is done in the parent 
> instead of the child as usual?

Yes.  The idea is that 'ssh-agent command' should be more-or-less equivalent to 
running 'command', with ssh-agent running as a subprocess.

The ssh-agent subprocess periodically checks to see if its parent is still 
alive, and it exits when the parent has died.  Someone should figure out why 
this is not working on Cygwin.

Ken

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27 14:27     ` Ken Brown
@ 2019-09-27 15:09       ` Vanda Vodkamilkevich
  2019-09-27 23:18         ` Ken Brown
       [not found]       ` <185c5774-dd8b-5488-b818-4cec5a24bf2d@cornell.edu>
  1 sibling, 1 reply; 13+ messages in thread
From: Vanda Vodkamilkevich @ 2019-09-27 15:09 UTC (permalink / raw)
  To: cygwin

Le ven. 27 sept. 2019 à 16:13, Ken Brown <kbrown@cornell.edu> a écrit :

> On 9/27/2019 9:37 AM, Norton Allen wrote:
> > On 9/26/2019 10:50 PM, Ken Brown wrote:
> >>
> >>> As a simple test example, consider:
> >>>
> >>> /bin/ssh-agent /bin/sleep 10
> >>>
> >>> While the sleep is still running, ps shows:
> >>>
> >>>         PID    PPID    PGID     WINPID   TTY         UID    STIME
> COMMAND
> >>>        1694    1693    1694       1576  ?          22534 00:01:10
> >>> /usr/bin/ssh-agent
> >>>        1653       1    1653      11740  cons1      22534 00:00:37
> /usr/bin/bash
> >>>        1693    1653    1693       1552  cons1      22534 00:01:10
> /usr/bin/sleep
> >>>
> >>> One oddity is that ssh-agent is listed as a subprocess of sleep
> >> ...but this isn't a bug.  ssh-agent forks, and then the parent execs
> the command.
> >
> > With the salient difference presumably being that the exec is done in
> the parent
> > instead of the child as usual?
>
> Yes.  The idea is that 'ssh-agent command' should be more-or-less
> equivalent to
> running 'command', with ssh-agent running as a subprocess.
>
> The ssh-agent subprocess periodically checks to see if its parent is still
> alive, and it exits when the parent has died.  Someone should figure out
> why
> this is not working on Cygwin.
>
> Ken
>
> Ken
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Hi,
this may probably be not fully related but I see from time to time a
strange behavior of ssh-agent (running in the background and initially
started by keychain launched in .bashrc) : the agent is running wild (25%
of cpu and never responding). It seems to occur (not systematically) when
network is disconnected and reconnected (this is on a laptop often removed
from the docking system). Do you have any idea how to diagnose the issue
more precisely?

Regards

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27 15:09       ` Vanda Vodkamilkevich
@ 2019-09-27 23:18         ` Ken Brown
  2019-09-27 23:59           ` Norton Allen
  0 siblings, 1 reply; 13+ messages in thread
From: Ken Brown @ 2019-09-27 23:18 UTC (permalink / raw)
  To: cygwin

On 9/27/2019 10:27 AM, Vanda Vodkamilkevich wrote:
> Le ven. 27 sept. 2019 à 16:13, Ken Brown <kbrown@cornell.edu> a écrit :
> 
>> On 9/27/2019 9:37 AM, Norton Allen wrote:
>>> On 9/26/2019 10:50 PM, Ken Brown wrote:
>>>>
>>>>> As a simple test example, consider:
>>>>>
>>>>> /bin/ssh-agent /bin/sleep 10
>>>>>
>>>>> While the sleep is still running, ps shows:
>>>>>
>>>>>          PID    PPID    PGID     WINPID   TTY         UID    STIME
>> COMMAND
>>>>>         1694    1693    1694       1576  ?          22534 00:01:10
>>>>> /usr/bin/ssh-agent
>>>>>         1653       1    1653      11740  cons1      22534 00:00:37
>> /usr/bin/bash
>>>>>         1693    1653    1693       1552  cons1      22534 00:01:10
>> /usr/bin/sleep
>>>>>
>>>>> One oddity is that ssh-agent is listed as a subprocess of sleep
>>>> ...but this isn't a bug.  ssh-agent forks, and then the parent execs
>> the command.
>>>
>>> With the salient difference presumably being that the exec is done in
>> the parent
>>> instead of the child as usual?
>>
>> Yes.  The idea is that 'ssh-agent command' should be more-or-less
>> equivalent to
>> running 'command', with ssh-agent running as a subprocess.
>>
>> The ssh-agent subprocess periodically checks to see if its parent is still
>> alive, and it exits when the parent has died.  Someone should figure out
>> why
>> this is not working on Cygwin.
> 
> Hi,
> this may probably be not fully related but I see from time to time a
> strange behavior of ssh-agent (running in the background and initially
> started by keychain launched in .bashrc) : the agent is running wild (25%
> of cpu and never responding). It seems to occur (not systematically) when
> network is disconnected and reconnected (this is on a laptop often removed
> from the docking system). Do you have any idea how to diagnose the issue
> more precisely?

Sorry, but I'm not an expert on ssh-agent.  Everything I said above is based on 
doing an internet search and looking briefly at the ssh-agent source code.

My only suggestion would be to attach gdb to the process when it starts running 
wild and see if you can figure out why it's inf-looping.  If you don't know how 
to do this, someone who does know would have to be able to reproduce the problem.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27 23:18         ` Ken Brown
@ 2019-09-27 23:59           ` Norton Allen
  0 siblings, 0 replies; 13+ messages in thread
From: Norton Allen @ 2019-09-27 23:59 UTC (permalink / raw)
  To: cygwin

On 9/27/2019 11:09 AM, Ken Brown wrote:
> On 9/27/2019 10:27 AM, Vanda Vodkamilkevich wrote:
>> Hi,
>> this may probably be not fully related but I see from time to time a
>> strange behavior of ssh-agent (running in the background and initially
>> started by keychain launched in .bashrc) : the agent is running wild (25%
>> of cpu and never responding). It seems to occur (not systematically) when
>> network is disconnected and reconnected (this is on a laptop often removed
>> from the docking system). Do you have any idea how to diagnose the issue
>> more precisely?
> Sorry, but I'm not an expert on ssh-agent.  Everything I said above is based on
> doing an internet search and looking briefly at the ssh-agent source code.
>
> My only suggestion would be to attach gdb to the process when it starts running
> wild and see if you can figure out why it's inf-looping.  If you don't know how
> to do this, someone who does know would have to be able to reproduce the problem.
I am not an ssh-agent expert either, but I can report that I have also 
observed this behavior on cygwin. I do not know how to reproduce it.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
       [not found]       ` <185c5774-dd8b-5488-b818-4cec5a24bf2d@cornell.edu>
@ 2019-10-04 14:27         ` Ken Brown
  2019-10-04 20:13           ` Ken Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Ken Brown @ 2019-10-04 14:27 UTC (permalink / raw)
  To: cygwin

On 9/29/2019 4:05 PM, Ken Brown wrote:
> On 9/27/2019 10:12 AM, Ken Brown wrote:
>> On 9/27/2019 9:37 AM, Norton Allen wrote:
>>> On 9/26/2019 10:50 PM, Ken Brown wrote:
>>>>
>>>>> As a simple test example, consider:
>>>>>
>>>>> /bin/ssh-agent /bin/sleep 10
>>>>>
>>>>> While the sleep is still running, ps shows:
>>>>>
>>>>>           PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>>>>>          1694    1693    1694       1576  ?          22534 00:01:10
>>>>> /usr/bin/ssh-agent
>>>>>          1653       1    1653      11740  cons1      22534 00:00:37 /usr/bin/bash
>>>>>          1693    1653    1693       1552  cons1      22534 00:01:10 /usr/bin/sleep
>>>>>
>>>>> One oddity is that ssh-agent is listed as a subprocess of sleep
>>>> ...but this isn't a bug.  ssh-agent forks, and then the parent execs the command.
>>>
>>> With the salient difference presumably being that the exec is done in the parent
>>> instead of the child as usual?
>>
>> Yes.  The idea is that 'ssh-agent command' should be more-or-less equivalent to
>> running 'command', with ssh-agent running as a subprocess.
>>
>> The ssh-agent subprocess periodically checks to see if its parent is still
>> alive, and it exits when the parent has died.  Someone should figure out why
>> this is not working on Cygwin.
> 
> As an aid to someone who might want to debug this (probably Corinna when she
> returns), I've created a test program agent.c (attached) that simulates the
> relevant part of ssh-agent:
> 
> 1. It forks a subprocess that periodically checks to see if its parent has died,
> and then exits.
> 
> 2. The parent execs "/usr/bin/sleep 1".
> 
> As with ssh-agent, the subprocess never detects that the parent has died, and so
> it never exits.
> 
> Running this program under strace shows the following error in the pinfo
> constructor:
> 
> pinfo::pinfo: couldn't duplicate parent rd_proc_pipe handle 0x1BC for forked
> child 1666 after exec, Win32 error 5
> 
> [Win32 error 5 is ERROR_ACCESS_DENIED.]

It seems that the pinfo constructor failure happens in 
cygheap_exec_info::reattach_children().  The latter is preceded by the following 
comment:

/* Reattach non-reaped subprocesses passed in from the cygwin process
    which previously operated under this pid.  FIXME: Is there a race here
    if the process exits during cygwin's exec handoff?  */

I tried running my test program under gdb with a breakpoint at 
reattach_children, and the breakpoint was never hit.  That gives an affirmative 
answer to the question in the FIXME.

As a result, the exec'd program never becomes aware that it has a subprocess, so 
it exits without resetting the subprocess's ppid to 1.

Is there someone out there familiar enough with Cygwin's exec to suggest a fix? 
It would be a nice gift to Corinna to get this fixed before her return.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-10-04 14:27         ` Ken Brown
@ 2019-10-04 20:13           ` Ken Brown
  0 siblings, 0 replies; 13+ messages in thread
From: Ken Brown @ 2019-10-04 20:13 UTC (permalink / raw)
  To: cygwin

On 10/4/2019 10:27 AM, Ken Brown wrote:
> On 9/29/2019 4:05 PM, Ken Brown wrote:
>> On 9/27/2019 10:12 AM, Ken Brown wrote:
>>> On 9/27/2019 9:37 AM, Norton Allen wrote:
>>>> On 9/26/2019 10:50 PM, Ken Brown wrote:
>>>>>
>>>>>> As a simple test example, consider:
>>>>>>
>>>>>> /bin/ssh-agent /bin/sleep 10
>>>>>>
>>>>>> While the sleep is still running, ps shows:
>>>>>>
>>>>>>            PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>>>>>>           1694    1693    1694       1576  ?          22534 00:01:10
>>>>>> /usr/bin/ssh-agent
>>>>>>           1653       1    1653      11740  cons1      22534 00:00:37 /usr/bin/bash
>>>>>>           1693    1653    1693       1552  cons1      22534 00:01:10 /usr/bin/sleep
>>>>>>
>>>>>> One oddity is that ssh-agent is listed as a subprocess of sleep
>>>>> ...but this isn't a bug.  ssh-agent forks, and then the parent execs the command.
>>>>
>>>> With the salient difference presumably being that the exec is done in the parent
>>>> instead of the child as usual?
>>>
>>> Yes.  The idea is that 'ssh-agent command' should be more-or-less equivalent to
>>> running 'command', with ssh-agent running as a subprocess.
>>>
>>> The ssh-agent subprocess periodically checks to see if its parent is still
>>> alive, and it exits when the parent has died.  Someone should figure out why
>>> this is not working on Cygwin.
>>
>> As an aid to someone who might want to debug this (probably Corinna when she
>> returns), I've created a test program agent.c (attached) that simulates the
>> relevant part of ssh-agent:
>>
>> 1. It forks a subprocess that periodically checks to see if its parent has died,
>> and then exits.
>>
>> 2. The parent execs "/usr/bin/sleep 1".
>>
>> As with ssh-agent, the subprocess never detects that the parent has died, and so
>> it never exits.
>>
>> Running this program under strace shows the following error in the pinfo
>> constructor:
>>
>> pinfo::pinfo: couldn't duplicate parent rd_proc_pipe handle 0x1BC for forked
>> child 1666 after exec, Win32 error 5
>>
>> [Win32 error 5 is ERROR_ACCESS_DENIED.]
> 
> It seems that the pinfo constructor failure happens in
> cygheap_exec_info::reattach_children().  The latter is preceded by the following
> comment:
> 
> /* Reattach non-reaped subprocesses passed in from the cygwin process
>      which previously operated under this pid.  FIXME: Is there a race here
>      if the process exits during cygwin's exec handoff?  */
> 
> I tried running my test program under gdb with a breakpoint at
> reattach_children, and the breakpoint was never hit.  That gives an affirmative
> answer to the question in the FIXME. >
> As a result, the exec'd program never becomes aware that it has a subprocess, so
> it exits without resetting the subprocess's ppid to 1.
> 
> Is there someone out there familiar enough with Cygwin's exec to suggest a fix?
> It would be a nice gift to Corinna to get this fixed before her return.

What I said above about gdb is nonsense.  It's the exec'd process that calls 
reattach_children, so I wouldn't expect gdb to see that call.  I think the rest 
of my analysis is correct, but I'm not sure that the FIXME explains the failure.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-09-27  0:34 ssh-agent doesn't die Tim Adye
  2019-09-27  2:43 ` Norton Allen
  2019-09-27  5:38 ` Ken Brown
@ 2019-11-03 19:01 ` Corinna Vinschen
  2019-11-04 11:49   ` Tim Adye
  2 siblings, 1 reply; 13+ messages in thread
From: Corinna Vinschen @ 2019-11-03 19:01 UTC (permalink / raw)
  To: Tim Adye; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

On Sep 27 00:42, Tim Adye wrote:
> Hi,
> 
> I have noticed a (new?) problem with using ssh-agent to start a session, eg.
> with
> 
>   ssh-agent xterm &
> 
> When the xterm (or whatever) command completes, the ssh-agent process is
> still left running in the background. It should stop once its subprocess is
> done.
> 
> As a simple test example, consider:
> 
> /bin/ssh-agent /bin/sleep 10
> 
> While the sleep is still running, ps shows:
> 
>       PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>      1694    1693    1694       1576  ?          22534 00:01:10
> /usr/bin/ssh-agent
>      1653       1    1653      11740  cons1      22534 00:00:37
> /usr/bin/bash
>      1693    1653    1693       1552  cons1      22534 00:01:10
> /usr/bin/sleep
> [...]
> Once the sleep finishes, ps shows:
> 
>       PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>      1694    1693    1694       1576  ?          22534 00:01:10
> /usr/bin/ssh-agent
>      1653       1    1653      11740  cons1      22534 00:00:37
> /usr/bin/bash
> 
> ie. ssh-agent is still running, though its PPID no longer exists.

I pushed a patch and created new developer snapshots.  Please test the
latest from https://cygwin.com/snapshots/


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-11-03 19:01 ` Corinna Vinschen
@ 2019-11-04 11:49   ` Tim Adye
  2019-11-04 14:17     ` Corinna Vinschen
  0 siblings, 1 reply; 13+ messages in thread
From: Tim Adye @ 2019-11-04 11:49 UTC (permalink / raw)
  To: cygwin

On 03/11/2019 19:00, Corinna Vinschen wrote:
> On Sep 27 00:42, Tim Adye wrote:
>> Hi,
>>
>> I have noticed a (new?) problem with using ssh-agent to start a session, eg.
>> with
>>
>>    ssh-agent xterm &
>>
>> When the xterm (or whatever) command completes, the ssh-agent process is
>> still left running in the background. It should stop once its subprocess is
>> done.
>>
>> As a simple test example, consider:
>>
>> /bin/ssh-agent /bin/sleep 10
>>
>> While the sleep is still running, ps shows:
>>
>>        PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>>       1694    1693    1694       1576  ?          22534 00:01:10
>> /usr/bin/ssh-agent
>>       1653       1    1653      11740  cons1      22534 00:00:37
>> /usr/bin/bash
>>       1693    1653    1693       1552  cons1      22534 00:01:10
>> /usr/bin/sleep
>> [...]
>> Once the sleep finishes, ps shows:
>>
>>        PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
>>       1694    1693    1694       1576  ?          22534 00:01:10
>> /usr/bin/ssh-agent
>>       1653       1    1653      11740  cons1      22534 00:00:37
>> /usr/bin/bash
>>
>> ie. ssh-agent is still running, though its PPID no longer exists.
> I pushed a patch and created new developer snapshots.  Please test the
> latest from https://cygwin.com/snapshots/

Hi Corinna,

That fixes the problem! With cygwin1-20191103.dll.xz installed as 
/usr/bin/cygwin1.dll, all my ssh-agent processes exit properly.

> Thanks,
> Corinna

Thanks for the excellent fix,
Tim.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ssh-agent doesn't die
  2019-11-04 11:49   ` Tim Adye
@ 2019-11-04 14:17     ` Corinna Vinschen
  0 siblings, 0 replies; 13+ messages in thread
From: Corinna Vinschen @ 2019-11-04 14:17 UTC (permalink / raw)
  To: Tim Adye; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 2009 bytes --]

On Nov  4 11:49, Tim Adye wrote:
> On 03/11/2019 19:00, Corinna Vinschen wrote:
> > On Sep 27 00:42, Tim Adye wrote:
> > > Hi,
> > > 
> > > I have noticed a (new?) problem with using ssh-agent to start a session, eg.
> > > with
> > > 
> > >    ssh-agent xterm &
> > > 
> > > When the xterm (or whatever) command completes, the ssh-agent process is
> > > still left running in the background. It should stop once its subprocess is
> > > done.
> > > 
> > > As a simple test example, consider:
> > > 
> > > /bin/ssh-agent /bin/sleep 10
> > > 
> > > While the sleep is still running, ps shows:
> > > 
> > >        PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
> > >       1694    1693    1694       1576  ?          22534 00:01:10
> > > /usr/bin/ssh-agent
> > >       1653       1    1653      11740  cons1      22534 00:00:37
> > > /usr/bin/bash
> > >       1693    1653    1693       1552  cons1      22534 00:01:10
> > > /usr/bin/sleep
> > > [...]
> > > Once the sleep finishes, ps shows:
> > > 
> > >        PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
> > >       1694    1693    1694       1576  ?          22534 00:01:10
> > > /usr/bin/ssh-agent
> > >       1653       1    1653      11740  cons1      22534 00:00:37
> > > /usr/bin/bash
> > > 
> > > ie. ssh-agent is still running, though its PPID no longer exists.
> > I pushed a patch and created new developer snapshots.  Please test the
> > latest from https://cygwin.com/snapshots/
> 
> Hi Corinna,
> 
> That fixes the problem! With cygwin1-20191103.dll.xz installed as
> /usr/bin/cygwin1.dll, all my ssh-agent processes exit properly.
> 
> > Thanks,
> > Corinna
> 
> Thanks for the excellent fix,
> Tim.

Thanks for testing,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-11-04 14:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27  0:34 ssh-agent doesn't die Tim Adye
2019-09-27  2:43 ` Norton Allen
2019-09-27  5:38 ` Ken Brown
2019-09-27 14:12   ` Norton Allen
2019-09-27 14:27     ` Ken Brown
2019-09-27 15:09       ` Vanda Vodkamilkevich
2019-09-27 23:18         ` Ken Brown
2019-09-27 23:59           ` Norton Allen
     [not found]       ` <185c5774-dd8b-5488-b818-4cec5a24bf2d@cornell.edu>
2019-10-04 14:27         ` Ken Brown
2019-10-04 20:13           ` Ken Brown
2019-11-03 19:01 ` Corinna Vinschen
2019-11-04 11:49   ` Tim Adye
2019-11-04 14:17     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).