Recv-Q buffer is filled up due to bgwriter continue sending statistics to un-launched stat collector

From: Hubert Zhang <zhubert(at)vmware(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Recv-Q buffer is filled up due to bgwriter continue sending statistics to un-launched stat collector
Date: 2020-11-19 02:18:17
Message-ID: BN6PR05MB349246FF3AA8D752AAFC6CF9C9E00@BN6PR05MB3492.namprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Bgwriter process will call `pgstat_send_bgwriter` to send statistics to stat collector, but stat collector is not started when standby is not in hot standby mode.

```
if (pmState == PM_RUN || pmState == PM_HOT_STANDBY)
PgStatPID = pgstat_start();
```

This would lead to the kernel Recv-Q buffer being filled up by checking `netstat -du`.
I think we should disable to send statistics in `pgstat_send_bgwriter` when stat collector is not running. So here are three questions about how to fix it.

1. Is there any way we could effectively check the status of stat collector in bgwriter process?
2. Is there any way we check the bgwriter is running on a standby but not in hot stanby mode?
3. Is there any other process will send statistics except the bgwriter in standby? We should fix it one by one or add a check in `pgstat_send` directly?

Thanks,
Hubert Zhang

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2020-11-19 02:43:07 RE: POC: postgres_fdw insert batching
Previous Message Michael Paquier 2020-11-19 02:16:05 Re: ResourceOwner refactoring