Fstrim.service

Добрый день, часто за последнее время приходится перезагружать контроллер, из-за заторможенный реакций или неисполнения правил. В systeamctl лежала следующая информация:

root@wirenboard-A7YKTPJ:~# systemctl --failed
  UNIT           LOAD   ACTIVE SUB    DESCRIPTION
● fstrim.service loaded failed failed Discard unused blocks on filesystems from /etc/fstab

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
1 loaded units listed.
root@wirenboard-A7YKTPJ:~# systemctl status fstrim
● fstrim.service - Discard unused blocks on filesystems from /etc/fstab
     Loaded: loaded (/lib/systemd/system/fstrim.service; static)
     Active: failed (Result: exit-code) since Mon 2025-03-03 00:54:13 MSK; 1 day 15h ago
TriggeredBy: ● fstrim.timer
       Docs: man:fstrim(8)
    Process: 25646 ExecStart=/sbin/fstrim --listed-in /etc/fstab:/proc/self/mountinfo --verbose --quiet-unsupported (code=exited, status=64)
   Main PID: 25646 (code=exited, status=64)
        CPU: 184ms

Warning: journal has been rotated since unit was started, output may be incomplete.

Логично что после перезагрузки проблема уходит, но лишь на пару-тройку дней.

Добрый день!

Для диагностики проблемы пришлите, пожалуйста, архив с диагностической информацией контроллера. Создание архива описано в документации.

Так же прошу выслать вывод команды top

top:

MiB Mem :    997.9 total,    587.7 free,    175.2 used,    235.1 buff/cache
MiB Swap:    256.0 total,    256.0 free,      0.0 used.    807.9 avail Mem 

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1717 root 20 0 867948 38824 16068 S 38.9 3.8 11:43.20 wb-rules
1655 mosquit+ 20 0 16192 9364 4936 S 20.1 0.9 4:31.55 mosquitto
1892 www-data 20 0 187040 8128 3308 S 14.2 0.8 2:47.43 nginx
1518 root 20 0 110484 10176 6420 S 13.2 1.0 3:38.92 wb-mqtt-serial
1899 root 20 0 90428 5328 3844 S 10.6 0.5 2:40.74 wb-mqtt-iec104
1691 root 20 0 68184 9756 5012 S 4.6 1.0 1:37.63 main
79 root 20 0 0 0 0 I 2.3 0.0 0:16.64 kworker/u8:2-events_unbound
11677 root 20 0 0 0 0 I 1.7 0.0 0:06.28 kworker/u8:0-events_unbound
17054 root 20 0 5480 2288 1752 R 1.0 0.2 0:00.26 top
11 root 20 0 0 0 0 S 0.3 0.0 0:01.56 ksoftirqd/0
12 root 20 0 0 0 0 I 0.3 0.0 0:03.95 rcu_sched
315 avahi 20 0 5544 2264 2004 S 0.3 0.2 0:00.53 avahi-daemon
685 root 20 0 0 0 0 S 0.3 0.0 0:11.56 RTW_CMD_THREAD
1618 root 20 0 64288 4720 4064 S 0.3 0.5 0:02.96 wb-mqtt-gpio
2958 root 20 0 64028 4684 4204 S 0.3 0.5 0:08.21 wb-mqtt-adc
14887 root 20 0 0 0 0 I 0.3 0.0 0:00.15 kworker/2:0-events_power_ef+
1 root 20 0 30076 7368 5484 S 0.0 0.7 0:04.84 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tasks_rude_
10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tasks_trace
13 root rt 0 0 0 0 S 0.0 0.0 0:00.02 migration/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1
16 root rt 0 0 0 0 S 0.0 0.0 0:00.01 migration/1
17 root 20 0 0 0 0 S 0.0 0.0 0:00.49 ksoftirqd/1
19 root 0 -20 0 0 0 I 0.0 0.0 0:00.50 kworker/1:0H-kblockd
20 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/2
21 root rt 0 0 0 0 S 0.0 0.0 0:00.01 migration/2
22 root 20 0 0 0 0 S 0.0 0.0 0:00.51 ksoftirqd/2
24 root 0 -20 0 0 0 I 0.0 0.0 0:00.20 kworker/2:0H-kblockd
25 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/3
26 root rt 0 0 0 0 S 0.0 0.0 0:00.02 migration/3
27 root 20 0 0 0 0 S 0.0 0.0 0:00.55 ksoftirqd/3
30 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kdevtmpfs
31 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns
33 root 20 0 0 0 0 S 0.0 0.0 0:00.00 oom_reaper
34 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 writeback
35 root 20 0 0 0 0 S 0.0 0.0 0:00.13 kcompactd0
65 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kblockd
66 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 blkcg_punt_bio
67 root -51 0 0 0 0 S 0.0 0.0 0:00.00 watchdogd

приложен диагностический архив, доступен только сотрудникам поддержки
(203,9 КБ)

wb-rules потребляет много ресурса CPU.

В логах есть ошибки о несуществующих элементах:

Mar 05 17:41:26 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr4: 0
Mar 05 17:41:26 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr1: 1
Mar 05 17:41:26 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr2: 2
Mar 05 17:41:26 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr3: 0
Mar 05 17:41:27 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr1: 1
Mar 05 17:41:27 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr2: 2
Mar 05 17:41:27 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr3: 3
Mar 05 17:41:27 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr4: 2
Mar 05 17:41:28 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr4: 2
Mar 05 17:41:29 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr1: 1
Mar 05 17:41:29 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr2: 2
Mar 05 17:41:29 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr3: 3
Mar 05 17:41:30 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr4: 2
Mar 05 17:41:30 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr1: 1
Mar 05 17:41:30 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr2: 2
Mar 05 17:41:30 wirenboard-A7YKTPJ wb-rules[1717]: ERROR: [rule error] failed to SetValue for unexisting control iRobo/Notp_gr3: 3

Проверьте правила в wb-rules на наличие циклических ошибок. Возможно, контролы были удалены или неправильно настроены и убедитесь, что устройства с этими контролами действительно подключены и доступны.

При нажатии сохранить в правилах, движок wb-rules читает все файлы заново и в лог такие ошибки больше не сыпятся.

Устройство, по которому сыпятся ошибки, подключено через modbus tcp, как нешаблонное. Списываем на то, что wb-rules успевают прочесться быстрее, чем подхватывается связь с этим модулем.

Если есть возможность, то попробуйте физически отключить это устройство и понаблюдайте за поведением контроллера.

Извините, не правильно объяснил, правило для этого устройства написаны следующим образом:

defineRule("",{
  when: cron("@every 2s"),
  then: function () {
  },
});

Первый такт он не подхватывает, а с последующими все в порядке. Поэтому нет необходимости отключать устройство или наблюдать за логами контроллера (в логи он пишет только ошибки за первые пару итераций пока подхватывается связь)

Загрузка CPU процессами:
wb-rules (43.9%),
mosquitto (16.9%),
wb-mqtt-serial (13.6%).

Возможно:

  • Слишком сложные или цикличные правила в wb-rules.
  • Перегрузка MQTT-сервера большим количеством сообщений.
  • Частые опросы устройств по Modbus.

Это может являться причиной медленной работы и перезагрузок.

Все же попробуйте снизить нагрузку на процессор, отключив некоторые правила, уменьшить частоту опроса Modbus устройств или вовсе исключить некоторые.

Добрый день! Вам удалось разобраться с причиной зависания?

Добрый день, оптимизировали wb-rules, разгрузили mosquitto, serial не могу уменьшить. Ошибки по fstrim больше не появлялись. Вы не могли бы углубленно проинформировать, почему процесс fstrim останавливается с ошибкой при перегрузке процессора?

Добрый день!

Точную причину возникновения такого поведения пока сообщить не могу.
Коллеги подсказали, что проблема известна и носит массовый характер.
Разработчики взяли в работу.