[pkg-gnupg-maint] Bug#841143: Bug#841143: False assumptions about nPth (was: Bug#841143: Suspected race in gpg1 to gpg2 conversion or agent startup)

NIIBE Yutaka gniibe at fsij.org
Wed Jan 18 10:08:58 UTC 2017


Daniel Kahn Gillmor <dkg at fifthhorseman.net> wrote:
> fwiw, i don't want the behavior to be exactly the same as upstream -- i
> don't want gpg-agent to wake up every few seconds on platforms where it
> shouldn't need to, for example :/

Yes, I understand your purpose.  +1 from me.  Actually, I was inspired
by your patches and I'd like to do something similar in scdaemon.

> but the change i think you're proposing might be OK -- if it does the
> frequent wakeups when it's trying to shut down...

Yes.  My intention was to minimize the change and to show the issue
clearly.  (And my preference is less change against upstream.)

My point was that there is a condition when the main thread keeps
blocking at npth_pselect, when shutdown_pending != 0.

Perhaps, you like Ian's approach better: when --active_connections == 0,
send SIGCONT to resume the main thread.

> You're just talking about adding this one test, right?

Exactly.

> It seems to me like this shouldn't be necessary, since i'd have thought
> the child channel (chan_9 in your example) receiving eof would make the
> main thread wake back up.

It is needed.  (With Ian's approach, the main thread is waken up.)

The main thread blocks at npth_pselect watching the sockets.  The
sockets are listening connection from client.  Connection comming, the
main thread accepts it (by new fd) and creates a thread to handle
commands from fd.  After creating a thread, the main thread does nothing
with the new fd, it's up to the new thread just created.

> Ideally, we don't want to wait a timer tick (up to 2 seconds) before
> shutting down.  if we know we're shutting down and the last client has
> closed, we should just fall into the main loop itself, right?

So, you like Ian's approach.

Ian's approach is to change the line of

  active_connections--;

into:

  if (--active_connections == 0)
    interrupt_main_thread_loop ();

There are two parts in gpg-agent.c to change.

I think that it does exactly what you described.

I'm glad that we communicate successfully, and we will have a fix soon.

I don't know if this fix solves all the problems of Ian.  One step done,
that's good.
-- 



More information about the pkg-gnupg-maint mailing list