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

From Hubert Zhang
Subject Recv-Q buffer is filled up due to bgwriter continue sending statistics to un-launched stat collector
Date
Msg-id BN6PR05MB349246FF3AA8D752AAFC6CF9C9E00@BN6PR05MB3492.namprd05.prod.outlook.com
Whole thread Raw
List 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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: ResourceOwner refactoring
Next
From: "tsunakawa.takay@fujitsu.com"
Date:
Subject: RE: POC: postgres_fdw insert batching