[pgpool-hackers: 4429] Re: pgpool4.2 - zero symbol in PID file

Igor Yurchenko harry.urcen at gmail.com
Mon Feb 12 08:29:45 JST 2024


Hi Tatsuo,

I get this point. It's why I didn't suggest it as a PR. I just wonder what
the motivation is for the zero symbol at the end of the PID number.
A PID file is always a ASCII-based text file (historically it was created
by echoing $! to a file in Unix shell). And commonly people read it as a
text file.

Don't take it as critics, it's just curious. Probably there is some trick
on it that I missed.

BR
Igor Yurchenko


On Thu, 25 Jan 2024 at 08:31, Tatsuo Ishii <ishii at sraoss.co.jp> wrote:

> > Hi guys...
> >
> > I've discovered that pgpool (at least version 4.2.6) for some unclear
> > reason writes a C-string terminal zero symbol to pid file with pid
> number.
> > It's uncommon approach and it cause raising an exception on standard
> python
> > code used for getting PID from a file:
> > ...
> > with open('/var/run/pgpool.pid') as f:
> >     pid = int(f.readline().strip())
> > ...
> > It works great for Postgresql. And I have no idea why it shouldn't work
> for
> > pgpool-II.
> > I've prepared a patch of the issue. Feel free to take it for your purpose
> > if you decide it's ok for you:
>
> Pgpool-II and PostgreSQL are different programs. For pgpool the pid
> file only includes process pid as a C string. Since a C string
> requires a null termination, it is natural for pgpool to have the pid
> file with trailing null.
>
> On the other hand PostgreSQL includes many other things than pid in
> the file.
>
> Another important point is, the pgpool pid format is there since
> Pgpool-II was born. There may be many tools/scripts depending on the
> pid file format. Changing the format will break them.
>
> Best reagards,
> --
> Tatsuo Ishii
> SRA OSS LLC
> English: http://www.sraoss.co.jp/index_en/
> Japanese:http://www.sraoss.co.jp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20240212/4af065d1/attachment.htm>


More information about the pgpool-hackers mailing list