Hi, do you set Accept=yes in your socket unit? I think ask-password.c and hostnamed.c might be some pretty barebones services to which you may compare your code - the former uses Accept=yes and the latter does not. If you do not use Accept=yes but terminate as soon as the only connection leaves it might result in quickly starting the service many times which could be penalized. Cheers, Nils On Wed, Jan 8, 2025 at 5:15 PM Thorsten Kukuk <kukuk@xxxxxxxx> wrote: > > ) > Hi, > > While sd-varlink works fine for me with always running daemons, I have > a bigger problem with socket activation. > So having "wtmpdbd.socket" and "wtmpdbd.service". > > If a tool connects to the socket, the daemon gets started, answers the > query and after the last connection is closed, quits. > But this only works for the first connection, every try afterwards > leads to ECONNREFUSED. > Any ideas what I'm missing? > > The code is more or less: > _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *varlink_server = NULL; > sd_varlink_server_new > sd_varlink_server_add_interface > sd_varlink_server_bind_method_many > sd_varlink_server_listen_address > sd_notify (0, "READY=1") > sd_varlink_server_loop_auto > sd_notify (0, "STOPPING=1") > return 0 > > The output is: > Jan 08 16:01:05 node179 systemd[1]: Listening on wtmpdb daemon (reader socket). > Jan 08 16:01:14 node179 systemd[1]: Starting wtmpdb daemon... > Jan 08 16:01:14 node179 wtmpdbd[42187]: Starting wtmpdbd (wtmpdb) 0.50.0... > Jan 08 16:01:14 node179 wtmpdbd[42187]: Varlink method "ReadAll" called... > Jan 08 16:01:14 node179 systemd[1]: Started wtmpdb daemon. > Jan 08 16:01:14 node179 systemd[1]: wtmpdbd.service: Deactivated successfully. > > Thanks, > Thorsten > > -- > Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies > SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 > Nuernberg, Germany > Managing Director: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB > 36809, AG Nürnberg)