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

Tatsuo Ishii ishii at sraoss.co.jp
Thu Jan 25 15:31:30 JST 2024


> 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


More information about the pgpool-hackers mailing list