Thread: Reloading pgbouncer and systemd

Reloading pgbouncer and systemd

From
Jehan-Guillaume de Rorthais
Date:
Hello,

While working with pgbouncer under CentOS7, I noticed an incompatibility
between pgbouncer and systemd when reloading.

The current reload command is:

  ExecReload=/usr/bin/pgbouncer -R -q ${BOUNCERCONF}

But this command create a new pgbouncer process...and keeps it in foreground.
As the service type is set as "forking", in this situation systemctl just sits
and wait for a return code (maybe there's a timeout, but I did not have the
patience to wait for it).

Either add a '-d' to this command, or send a HUP signal to the process.

I prefer the second option as it doesn't create a new process that takes over
the sockets, but just reloads the conf file as expected. Much lighter.

So, imho, the pgbouncer.service file should have:

  ExecReload=/bin/kill -HUP $MAINPID

Regards
--
Jehan-Guillaume de Rorthais
Dalibo


Re: Reloading pgbouncer and systemd

From
Jehan-Guillaume de Rorthais
Date:
Le Mon, 22 Feb 2016 17:38:45 +0100,
Jehan-Guillaume de Rorthais <jgdr@dalibo.com> a écrit :

> Hello,
>
> While working with pgbouncer under CentOS7, I noticed an incompatibility
> between pgbouncer and systemd when reloading.
>
> The current reload command is:
>
>   ExecReload=/usr/bin/pgbouncer -R -q ${BOUNCERCONF}
>
> But this command create a new pgbouncer process...and keeps it in foreground.
> As the service type is set as "forking", in this situation systemctl just sits
> and wait for a return code (maybe there's a timeout, but I did not have the
> patience to wait for it).
>
> Either add a '-d' to this command, or send a HUP signal to the process.
>
> I prefer the second option as it doesn't create a new process that takes over
> the sockets, but just reloads the conf file as expected. Much lighter.
>
> So, imho, the pgbouncer.service file should have:
>
>   ExecReload=/bin/kill -HUP $MAINPID

Any feedback on this ?


Re: Reloading pgbouncer and systemd

From
Devrim Gündüz
Date:
Hi,

Looks good to me. Can you please create a ticket for this, so that we can keep
track?

https://redmine.postgresql.org/projects/pgrpms/issues/new

Cheers, Devrim

On Mon, 2016-02-22 at 17:38 +0100, Jehan-Guillaume de Rorthais wrote:
> Hello,
>
> While working with pgbouncer under CentOS7, I noticed an incompatibility
> between pgbouncer and systemd when reloading.
>
> The current reload command is:
>
>   ExecReload=/usr/bin/pgbouncer -R -q ${BOUNCERCONF}
>
> But this command create a new pgbouncer process...and keeps it in foreground.
> As the service type is set as "forking", in this situation systemctl just
> sits
> and wait for a return code (maybe there's a timeout, but I did not have the
> patience to wait for it).
>
> Either add a '-d' to this command, or send a HUP signal to the process.
>
> I prefer the second option as it doesn't create a new process that takes over
> the sockets, but just reloads the conf file as expected. Much lighter.
>
> So, imho, the pgbouncer.service file should have:
>
>   ExecReload=/bin/kill -HUP $MAINPID
>
> Regards
> -- 
> Jehan-Guillaume de Rorthais
> Dalibo
>
>


--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR



Attachment

Re: Reloading pgbouncer and systemd

From
Jehan-Guillaume de Rorthais
Date:
Le Wed, 30 Mar 2016 16:15:00 +0300,
Devrim Gündüz <devrim@gunduz.org> a écrit :

> Looks good to me. Can you please create a ticket for this, so that we can keep
> track?

Done: https://redmine.postgresql.org/issues/1042

Thank you Devrim!

> On Mon, 2016-02-22 at 17:38 +0100, Jehan-Guillaume de Rorthais wrote:
> > Hello,
> >
> > While working with pgbouncer under CentOS7, I noticed an incompatibility
> > between pgbouncer and systemd when reloading.
> >
> > The current reload command is:
> >
> >   ExecReload=/usr/bin/pgbouncer -R -q ${BOUNCERCONF}
> >
> > But this command create a new pgbouncer process...and keeps it in
> > foreground. As the service type is set as "forking", in this situation
> > systemctl just sits
> > and wait for a return code (maybe there's a timeout, but I did not have the
> > patience to wait for it).
> >
> > Either add a '-d' to this command, or send a HUP signal to the process.
> >
> > I prefer the second option as it doesn't create a new process that takes
> > over the sockets, but just reloads the conf file as expected. Much lighter.
> >
> > So, imho, the pgbouncer.service file should have:
> >
> >   ExecReload=/bin/kill -HUP $MAINPID