Nextcloud 22, Logs filling up fast. PHP dns error

Nextcloud version :
Operating system and version : TrueNAS Core 12-U4
Caddy: Caddy v2.4.3 h1
PHP version (eg, 7.4): 7.4

Is this the first time you’ve seen this error? (Y/N): N

The output of your Nextcloud log in Admin > Logging:

Error: Invalid argument supplied for foreach() at /usr/local/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php#69		2021-07-17T14:03:09+0400
Error	PHP	Error: count(): Parameter must be an array or an object that implements Countable at /usr/local/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php#68		2021-07-17T14:03:09+0400
Error	PHP	Error: dns_get_record(): DNS Query failed at /usr/local/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php#66

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'ocp3f65wl17d',
  'passwordsalt' => 'EDITED',
  'secret' => 'EDITED',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
  'default_phone_region' => 'US',
  'datadirectory' => '/mnt/files',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => '',
  'dbport' => '3306',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'EDITED',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  array (
    '\\OC\\Memcache\\Redis' => '=',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
  'trusted_proxies' =>
  array (
    0 => '',
  'overwrite.cli.url' => 'EDITED',
  'app_install_overwrite' =>
  array (
    0 => 'previewgenerator',
    1 => 'uploaddetails',
    2 => 'ocdownloader',
  'maintenance' => false,

Those errors in nextcloud log keep popping up every 2-3 minutes and fills my log file pretty fast.
Its always those 3 errors in succession. It looks like dns errors but nextcloud has internet and dns is working fine on the server. Any way I can at least supress these messages as they dont seem to cause any harm.

There was something popping up in FreeBSD systems:

Fix will be in NC 22.0.1: [stable22] Check if dns_get_record returns non-false by backportbot-nextcloud · Pull Request #27925 · nextcloud/server · GitHub

In this case you can easily try yourself by changing it yourself.

I did try to fix it myself, after I posted this I found the github issue, however I still have the dns error, I mentioned that on the github post but the issue is closed now.

Error	PHP	Error: dns_get_record(): DNS Query failed at /usr/local/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php#66

The other 2 errors are thankfully gone now.

they exchanged about some manual commands you can run to check the name resolution. Did you try that?