Re: [systemd-devel] [hostnamed] Why the service will automatically exit after 30 seconds

2021-08-19 Thread Lennart Poettering
On Do, 19.08.21 11:38, Michael Chapman (m...@very.puzzling.org) wrote:

> I've looked at this more closely now, and it's a bit more complicated than
> I would have liked.
>
> While hostnamed's own idle timeout can easily be disabled while a
> polkit conversation is in progress, that won't necessarily help anybody
> using hostnamectl. hostnamectl uses sd-bus's default method call timeout,
> which is 25 seconds.

If the exit-on-idle logic doesn't take outstanding policykit requests
into account that's a bug and should be fixed. Please file a github issue.

> Perhaps this should be increased for method calls that are likely to
> result in using polkit? 25 seconds might be too short for some people to
> enter their password.

We have a define HOME_SLOW_BUS_CALL_TIMEOUT_USEC which is what we use
for "slow" bus calls, typically, instead of of the default of 25s. We
use it wherever we expect "slow" method calls, because of
interactivity and such. It's used in a bunch of places, but likely not
at enough. File a bug if you found a place where we should.

> Is it possible for sd_bus_call to detect that the recipient of a call has
> dropped off the bus and is never going to return a response? If that were
> possible we could possibly rely on that rather than an explicit timeout. I
> think the answer to this question might be "no" though...

it detects that out-of-the-box.

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] [hostnamed] Why the service will automatically exit after 30 seconds

2021-08-18 Thread Michael Chapman
On Thu, 19 Aug 2021, Michael Chapman wrote:
> On Thu, 19 Aug 2021, Cristian Rodríguez wrote:
> > On Tue, Aug 17, 2021 at 9:35 PM 李成刚  wrote:
> > >
> > > How to configure this service so that it will not automatically exit
> > 
> > 
> > So what are you trying to accomplish with this ? why do you need yet
> > another service running when it is totally idle ?
> > 
> > > When the systemd-hostnamed service is started through policykit, the 
> > > password window will automatically exit, which seems to be a terrible 
> > > experience
> > 
> > DAFUQ? if polkit is really talking to hostnamed then has to deal with
> > things so they either remaining alive or connect again ...
> 
> It's the other way around. hostnamed uses polkit to authorise requests 
> sent to it over D-Bus.
> 
> If hostnamed is exiting while in the middle of a polkit conversation, then 
> yes I would say that is a bug in hostnamed. It really ought not to do 
> that.

I've looked at this more closely now, and it's a bit more complicated than 
I would have liked.

While hostnamed's own idle timeout can easily be disabled while a 
polkit conversation is in progress, that won't necessarily help anybody 
using hostnamectl. hostnamectl uses sd-bus's default method call timeout, 
which is 25 seconds.

Perhaps this should be increased for method calls that are likely to 
result in using polkit? 25 seconds might be too short for some people to 
enter their password.

Is it possible for sd_bus_call to detect that the recipient of a call has 
dropped off the bus and is never going to return a response? If that were 
possible we could possibly rely on that rather than an explicit timeout. I 
think the answer to this question might be "no" though...

Re: [systemd-devel] [hostnamed] Why the service will automatically exit after 30 seconds

2021-08-18 Thread Michael Chapman
On Thu, 19 Aug 2021, Cristian Rodríguez wrote:
> On Tue, Aug 17, 2021 at 9:35 PM 李成刚  wrote:
> >
> > How to configure this service so that it will not automatically exit
> 
> 
> So what are you trying to accomplish with this ? why do you need yet
> another service running when it is totally idle ?
> 
> > When the systemd-hostnamed service is started through policykit, the 
> > password window will automatically exit, which seems to be a terrible 
> > experience
> 
> DAFUQ? if polkit is really talking to hostnamed then has to deal with
> things so they either remaining alive or connect again ...

It's the other way around. hostnamed uses polkit to authorise requests 
sent to it over D-Bus.

If hostnamed is exiting while in the middle of a polkit conversation, then 
yes I would say that is a bug in hostnamed. It really ought not to do 
that.

Re: [systemd-devel] [hostnamed] Why the service will automatically exit after 30 seconds

2021-08-18 Thread Cristian Rodríguez
On Tue, Aug 17, 2021 at 9:35 PM 李成刚  wrote:
>
> How to configure this service so that it will not automatically exit


So what are you trying to accomplish with this ? why do you need yet
another service running when it is totally idle ?

> When the systemd-hostnamed service is started through policykit, the password 
> window will automatically exit, which seems to be a terrible experience

DAFUQ? if polkit is really talking to hostnamed then has to deal with
things so they either remaining alive or connect again ...


Re: [systemd-devel] [hostnamed] Why the service will automatically exit after 30 seconds

2021-08-18 Thread Michael Biebl
Am Mi., 18. Aug. 2021 um 03:35 Uhr schrieb 李成刚 :
>
> How to configure this service so that it will not automatically exit

You can't. The exit-on-idle timeout of 30s is hard-coded.


[systemd-devel] [hostnamed] Why the service will automatically exit after 30 seconds

2021-08-17 Thread 李成刚
How to configure this service so that it will not automatically exit