openssh-agent polling

Damien Miller djm at mindrot.org
Sat Sep 15 08:37:02 EST 2007


On Fri, 14 Sep 2007, Peter Stuge wrote:

> On Thu, Sep 13, 2007 at 10:50:57PM +1000, Darren Tucker wrote:
> > Peter Stuge wrote:
> > > On Thu, Sep 13, 2007 at 04:00:22PM +1000, David Leonard wrote:
> > >> There is a 10 second parent polling behaviour which is probably
> > >> what powertop is seeing.. select is using a timeout being the
> > >> minimum of the poll time (10sec) or the next time a key expires.
> > > 
> > > What if you remove the timeout?
> > 
> > The agent will hang around forever after the process it's serving
> > has gone away, unless a key happens to expire.
> 
> I see. The only solution to this that I can come up with is another
> process who waitpid()s on the parent, and a pipe() or signal back to
> the main ssh-agent so that it can select() without a timeout.
> 
> A small improvement over the current state would be that ssh-agent
> then exits as soon as the parent exits, rather than after an
> arbitrary timeout - at the cost of a new process.

You can avoid the polling now by not executing a subcommand when starting
ssh-agent. I.e. run:

eval `ssh-agent`

instead of:

ssh-agent whatever

This will leave an ssh-agent around unless you have a symmetric
"ssh-agent -k" in your logout scripts.

-d


More information about the openssh-unix-dev mailing list