<div dir="ltr"><div><div>Hi Tatsuo, <br></div><div><br></div>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. <br></div><div>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.</div><div><br></div><div>Don't take it as critics, it's just curious. Probably there is some trick on it that I missed. </div><div><br></div><div><div><div><div><div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>BR</div><div>Igor Yurchenko<br></div></div></div></div><br></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 25 Jan 2024 at 08:31, Tatsuo Ishii <<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Hi guys...<br>
> <br>
> I've discovered that pgpool (at least version 4.2.6) for some unclear<br>
> reason writes a C-string terminal zero symbol to pid file with pid number.<br>
> It's uncommon approach and it cause raising an exception on standard python<br>
> code used for getting PID from a file:<br>
> ...<br>
> with open('/var/run/pgpool.pid') as f:<br>
> pid = int(f.readline().strip())<br>
> ...<br>
> It works great for Postgresql. And I have no idea why it shouldn't work for<br>
> pgpool-II.<br>
> I've prepared a patch of the issue. Feel free to take it for your purpose<br>
> if you decide it's ok for you:<br>
<br>
Pgpool-II and PostgreSQL are different programs. For pgpool the pid<br>
file only includes process pid as a C string. Since a C string<br>
requires a null termination, it is natural for pgpool to have the pid<br>
file with trailing null.<br>
<br>
On the other hand PostgreSQL includes many other things than pid in<br>
the file.<br>
<br>
Another important point is, the pgpool pid format is there since<br>
Pgpool-II was born. There may be many tools/scripts depending on the<br>
pid file format. Changing the format will break them.<br>
<br>
Best reagards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS LLC<br>
English: <a href="http://www.sraoss.co.jp/index_en/" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en/</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
</blockquote></div>