[pgpool-hackers: 3994] Re: Fix pgpoolLogger uses 100% cpu when log rotation is enabled
方俊
fangjun06608 at hundsun.com
Thu Aug 12 16:07:08 JST 2021
If timeout.tv_usec is not initialized and its value happened to be a very large number, the select returns -1 immediately ,with errno EINVAL. The code is in a for() statement, so the cpu goes up to 100%.
One can reproduce it by setting
timeout.tv_sec = 5000; // >0
timeout.tv_usec = 234567890123456;
在 2021年8月12日 13:48,Tatsuo Ishii <ishii at sraoss.co.jp>写道:
> Hi,
>
> I found that when log rotation is enabled, the subprocess pgpoolLogger uses
> 100% cpu, and pgpool -m fast stop can work properly.
>
> Following is an example conf:
>
> log_truncate_on_rotation = on
>
> log_rotation_age = 1d
>
> log_rotation_size = 100MB
>
>
>
> The reason is that the `timeout` pssed to select is not initialized
> completely.
>
> Text picked from man select(2):
>
> Consider timeout to be undefined after select() returns.
>
>
>
> Git patch is attached.
Thank you for the patch. However I am confused why the patch resolves
the cpu usage issue. Moreover, the 100% cpu consuming does not happen
on my environment. Can you please elaborate why current code consumes 100% cpu?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
More information about the pgpool-hackers
mailing list