production.ERROR: reset(): Argument #1 ($array) must be of type array

====================================

Component Version
LibreNMS 21.9.0-76-g16584d809
DB Schema 2021_25_01_0129_isis_adjacencies_nullable (221)
PHP 8.0.3
Python 3.7.3
MySQL 10.3.31-MariaDB-0+deb10u1-log
RRDTool 1.7.1
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 2.1.9
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

Hi Folks,
anyone having an idea where I should get started with nailing down that issue?

[…]
[2021-10-13 00:27:16] production.ERROR: count(): Argument #1 ($var) must be of type Countable|array, bool given {“exception”:"[object] (TypeError(code: 0): count(): Argument #1 ($var) must be of type Countable|array, bool given at /opt/librenms/includes/polling/entity-physical/cimc.inc.php:21)
[stacktrace]
#0 /opt/librenms/includes/polling/entity-physical.inc.php(7): include()
#1 /opt/librenms/includes/polling/functions.inc.php(330): include(’…’)
#2 /opt/librenms/poller.php(135): poll_device()
#3 {main}
“}
/opt/librenms/poller.php 205 2021-10-13 00:27:17 - 1 devices polled in 14.16 secs
/opt/librenms/poller.php 215 2021-10-13 00:27:18 - 1 devices polled in 56.19 secs
[2021-10-13 00:27:18] production.ERROR: reset(): Argument #1 ($array) must be of type array, bool given {“exception”:”[object] (TypeError(code: 0): reset(): Argument #1 ($array) must be of type array, bool given at /opt/librenms/includes/polling/applications/memcached.inc.php:14)
[stacktrace]
#0 /opt/librenms/includes/polling/applications/memcached.inc.php(14): reset()
#1 /opt/librenms/includes/polling/applications.inc.php(9): include(’…’)
#2 /opt/librenms/includes/polling/functions.inc.php(330): include(’…’)
#3 /opt/librenms/poller.php(135): poll_device()
#4 {main}
“}
/opt/librenms/poller.php 2 2021-10-13 00:27:18 - 1 devices polled in 58.42 secs
[2021-10-13 00:27:18] production.ERROR: reset(): Argument #1 ($array) must be of type array, bool given {“exception”:”[object] (TypeError(code: 0): reset(): Argument #1 ($array) must be of type array, bool given at /opt/librenms/includes/polling/applications/memcached.inc.php:14)
[stacktrace]
#0 /opt/librenms/includes/polling/applications/memcached.inc.php(14): reset()
#1 /opt/librenms/includes/polling/applications.inc.php(9): include(’…’)
#2 /opt/librenms/includes/polling/functions.inc.php(330): include(’…’)
#3 /opt/librenms/poller.php(135): poll_device()
#4 {main}
“}
[2021-10-13 00:27:18] production.ERROR: reset(): Argument #1 ($array) must be of type array, bool given {“exception”:”[object] (TypeError(code: 0): reset(): Argument #1 ($array) must be of type array, bool given at /opt/librenms/includes/polling/applications/memcached.inc.php:14)
[stacktrace]
#0 /opt/librenms/includes/polling/applications/memcached.inc.php(14): reset()
#1 /opt/librenms/includes/polling/applications.inc.php(9): include(’…’)
#2 /opt/librenms/includes/polling/functions.inc.php(330): include(’…’)
#3 /opt/librenms/poller.php(135): poll_device()
#4 {main}
“}
/opt/librenms/poller.php 176 2021-10-13 00:27:18 - 1 devices polled in 15.33 secs
/opt/librenms/poller.php 177 2021-10-13 00:27:18 - 1 devices polled in 15.70 secs
[2021-10-13 00:27:19] production.ERROR: Cannot access offset of type string on string {“exception”:”[object] (TypeError(code: 0): Cannot access offset of type string on string at /opt/librenms/includes/discovery/arp-table.inc.php:51)
[stacktrace]
#0 /opt/librenms/includes/discovery/functions.inc.php(154): include()
#1 /opt/librenms/discovery.php(117): discover_device()
#2 {main}
“}
/opt/librenms/poller.php 194 2021-10-13 00:27:19 - 1 devices polled in 14.25 secs
[2021-10-13 00:27:19] production.ERROR: count(): Argument #1 ($value) must be of type Countable|array, null given {“exception”:”[object] (TypeError(code: 0): count(): Argument #1 ($value) must be of type Countable|array, null given at /opt/librenms/includes/polling/unix-agent/packages.inc.php:103)
[stacktrace]
#0 /opt/librenms/includes/polling/unix-agent/packages.inc.php(103): count()
#1 /opt/librenms/includes/polling/unix-agent.inc.php(83): include(’…’)
#2 /opt/librenms/includes/polling/functions.inc.php(330): include(’…’)
#3 /opt/librenms/poller.php(135): poll_device()
#4 {main}
“}
[2021-10-13 00:27:19] production.ERROR: Cannot use a scalar value as an array {“exception”:”[object] (Error(code: 0): Cannot use a scalar value as an array at /opt/librenms/includes/rewrites.php:45)
[stacktrace]
#0 /opt/librenms/includes/discovery/discovery-arp.inc.php(45): cleanPort()
#1 /opt/librenms/includes/discovery/functions.inc.php(154): include(’…’)
#2 /opt/librenms/discovery.php(117): discover_device()
#3 {main}
"}
[…]

Appreciated some ideas and help!

Thank you,
Wolfgang

If you modify this line

To
if (is_array($components) && count($components > 0)) {

Does it work then?

Look a little more closely, the count() is always checking the count of a boolean.

@wriedel if you could supply a snmprec file for testing that would be great! ./scripts/collect-snmp-data.php

Hi Folks,
many thanks for you help!
The issues had been with nearly every host and in particular with “Apps”.
Therefore must have been something fundamental.

I downgraded to PHP 7.4.24 and now everything work like a charm.
Looks like there is some issue with PHP 8.0 ???

====================================

Component Version
LibreNMS 21.9.0-78-g526afd437
DB Schema 2021_25_01_0129_isis_adjacencies_nullable (221)
PHP 7.4.24
Python 3.7.3
MySQL 10.3.31-MariaDB-0+deb10u1-log
RRDTool 1.7.1
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 2.1.9
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.