Closed ankerstal closed 1 year ago
Hey there @adamchengtkc, @janiversen, @vzahradnik, mind taking a look at this issue as it has been labeled with an integration (modbus
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
modbus documentation modbus source (message by IssueLinks)
Please have a look in the log before the part you posted, there should be an error/warning from modbus. I need that to see what might be wrong. It is clearly modbus that reports a problem, but the cause might come from other parts. The problem you report is because modbus is being forcefully stopped, we need to know the cause of that.
I actually disabled the modbus integration yesterday in order to see if it helps, so I dont have any logs right now..
But I have reason to believe that the problem is actually really slow i/o from the SD card. I have ordered a SSD and will try to see if that helps. If it helps I will close this issue.
I have 2 servers running on RPI4, both with a number of integrations, but one have a lot of modbus entities and the other have a lot of shelly entities.
I throw away the SD card about a year ago (even though they were the face A2 type), because I continued to experience strange problems..especially when I added debug to either the modbus or shelly integrations. I just checked uptime, 1 RPI4 have been running for 3months and the other for 2weeks (the restarts correspond to some major upgrades I did).
Let me hear how your experiment goes....I am still not ruling out that it can a modbus problem, most software is "an accident waiting to happen".
Hi!
I changed SD card for a SSD now and everything seems to run smoothly. But I still got problems with the modbus integration. Today i stopped working again with alot of the following in the logs:
2023-01-03 17:29:27.656 ERROR (SyncWorker_10) [homeassistant.components.modbus.modbus] Pymodbus: ftx: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response rec
eived, expected at least 8 bytes (0 received)
2023-01-03 17:29:27.777 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/modbus/binary_sensor.py", line 99, in async_update
result = await self._hub.async_pymodbus_call(
File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 409, in async_pymodbus_call
result = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 386, in _pymodbus_call
result = entry.func(address, value, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/common.py", line 48, in read_coils
return self.execute(request)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 109, in execute
return self.transaction.execute(request)
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 174, in execute
response, last_exception = self._transact(
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 294, in _transact
result = self._recv(response_length, full)
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 362, in _recv
result = self.client.framer.recvPacket(expected_response_length)
File "/usr/local/lib/python3.10/site-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
return self.client.recv(size)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 89, in recv
return self._recv(size)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 293, in _recv
ready = select.select([self.socket], [], [], end - time_)
ValueError: filedescriptor out of range in select()
2023-01-03 17:29:27.989 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/modbus/binary_sensor.py", line 99, in async_update
result = await self._hub.async_pymodbus_call(
File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 409, in async_pymodbus_call
result = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 386, in _pymodbus_call
result = entry.func(address, value, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/common.py", line 48, in read_coils
return self.execute(request)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 109, in execute
return self.transaction.execute(request)
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 174, in execute
response, last_exception = self._transact(
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 294, in _transact
result = self._recv(response_length, full)
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 362, in _recv
result = self.client.framer.recvPacket(expected_response_length)
File "/usr/local/lib/python3.10/site-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
return self.client.recv(size)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 89, in recv
return self._recv(size)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 293, in _recv
ready = select.select([self.socket], [], [], end - time_)
ValueError: filedescriptor out of range in select()
I cant really se any significant errors before this in the log.
Nevermind, it seems like this problem is caused by another integration exhausting resources by not closing tcp connections after it was used. The memory problem was solved by disable the integration. And I guess "filedescriptor out of range" will be solved as well.
The problem
For the last two months or something my homeassitant has started to restart on a semi regular basis. It seems to be some sort of memory problem. Se graph below:
Im using a RPI 4 with 8GB memory and the standard docker container. (homeassistant/raspberrypi4-homeassistant:stable) and right now the running version is 2022.12.8.
First I thought the problem was the onvif integration but after disable all instances of onvif the problem persists. Find logs below.
What version of Home Assistant Core has the issue?
2022.12.8
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
modnus
Link to integration documentation on our website
https://www.home-assistant.io/integrations/modbus/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response