openhab-addons: [homekit] Binding stops working after a couple of days
Current Behavior
I am using the Homekit binding to make approx. 50 openHAB items available for control via Siri. After a seemingly random amount of time - mostly a couple of days - the binding stops working. The symptoms are that the Home app flags all items with “no response”.
We have two HomePods and an Apple TV. All three are listed as Homekit hubs in the Home app settings. We tried to reboot the device shown as “connected” (as opposed to “standby”) in the Home app settings when the problem occurred. But that didn’t help.
If I check Karaf console, I can see that a ConcurrentModificationException has been logged. The following is an abbreviated copy & paste of my Karaf console output spanning approx two weeks and showing two consecutive incidents. Although I am not 100% sure that the Exception is directly related to the issue it was there every time I checked the server after Homekit stopped working. As can be seen I can correct the issue if I just restart the binding. Seconds later all Homekit items become responsive again.
_ _ _ ____
___ ___ ___ ___ | | | | / \ | __ )
/ _ \ / _ \ / _ \ / _ \ | |_| | / _ \ | _ \
| (_) | (_) | __/| | | || _ | / ___ \ | |_) )
\___/| __/ \___/|_| |_||_| |_|/_/ \_\|____/
|_| 3.1.0-SNAPSHOT - Build #2101
...
openhab> Exception in thread "SocketListener(macmini-2012-fritz-box.local.)" java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1043)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:997)
at javax.jmdns.impl.DNSCache.getDNSEntry(DNSCache.java:142)
at javax.jmdns.impl.JmDNSImpl.handleRecord(JmDNSImpl.java:1362)
at javax.jmdns.impl.JmDNSImpl.handleResponse(JmDNSImpl.java:1476)
at javax.jmdns.impl.SocketListener.run(SocketListener.java:77)
bundle:list
START LEVEL 100 , List Threshold: 50
ID │ State │ Lvl │ Version │ Name
────┼────────┼─────┼─────────────────────────┼──────────────────────────────────────────────────────────────
...
227 │ Active │ 80 │ 3.1.0.202012260419 │ openHAB Add-ons :: Bundles :: IO :: Homekit
...
openhab> bundle:restart 227
... a couple of days later, no additional output logged ...
openhab> Exception in thread "SocketListener(2a02-908-d81-9640-b0b2-4528-a5a5-dd04-en0.local.)" java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1043)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:997)
at javax.jmdns.impl.DNSCache.getDNSEntry(DNSCache.java:142)
at javax.jmdns.impl.JmDNSImpl.handleRecord(JmDNSImpl.java:1362)
at javax.jmdns.impl.JmDNSImpl.handleResponse(JmDNSImpl.java:1476)
at javax.jmdns.impl.SocketListener.run(SocketListener.java:77)
Exception in thread "SocketListener(macmini-2012-fritz-box.local.)" java.lang.NullPointerException
at javax.jmdns.impl.JmDNSImpl.handleRecord(JmDNSImpl.java:1373)
at javax.jmdns.impl.JmDNSImpl.handleResponse(JmDNSImpl.java:1476)
at javax.jmdns.impl.SocketListener.run(SocketListener.java:77)
bundle:restart 227
openhab>
Steps to Reproduce (for Bugs)
Unfortunately this issue seems to happen at random. I do not know of a way to reproduce it at will.
Your Environment
Here is the output of the Karaf “info” command:
Karaf
Karaf version 4.2.7
Karaf home /Users/administrator/openhab/runtime
Karaf base /Users/administrator/openhab/userdata
OSGi Framework org.eclipse.osgi-3.12.100.v20180210-1608
JVM
Java Virtual Machine OpenJDK 64-Bit Server VM version 11.0.9+11
Version 11.0.9
Vendor AdoptOpenJDK
Pid 29796
Uptime 14 days 23 hours
Process CPU time 11 hours 23 minutes
Process CPU load 0.00
System CPU load 0.00
Open file descriptors 323
Max file descriptors 10,240
Total compile time 13 minutes
Threads
Live threads 312
Daemon threads 126
Peak 356
Total started 485947
Memory
Current heap size 371,764 kbytes
Maximum heap size 4,194,304 kbytes
Committed heap size 576,512 kbytes
Pending objects 0
Garbage collector Name = 'G1 Young Generation', Collections = 9834, Time = 58.410 seconds
Garbage collector Name = 'G1 Old Generation', Collections = 0, Time = 0.000 seconds
Classes
Current classes loaded 21,664
Total classes loaded 32,984
Total classes unloaded 11,320
Operating system
Name Mac OS X version 10.15.7
Architecture x86_64
Processors 4
I am currently running the 3.1.0-SNAPSHOT of openHAB, but I had this issue with the milestones (and I believe the 3.0 release) as well. It is hard to tell as the milestones sometimes got released faster than the issue usually appears.
As can be seen on the Karaf output the system I am running openHAB on is a mac Mini 2012 running macOS Catalina. The system is used exclusively for openHAB.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (2 by maintainers)
Commits related to this issue
- Disable IPv6 (https://github.com/openhab/openhab-addons/issues/9773) — committed to markuslindenberg/habfw by markuslindenberg 3 years ago
For the moment I am using a simple cron to detect the corrupted state of the bundle to restart it periodically. Not a beauty, but it minimizes the impact… Adjust to your likings. OpenHab is my only homekit bridge at home so I can detect the faulty state by detecting the missing
_hap._tcpMDNS entry.Deactivating IPv6 for my entire Raspberry Pi helped!
https://github.com/jmdns/jmdns/issues/211
There is an open issue at the jmDNS repository
@yfre I’ve been using 3.3.0 Release for quite a while now and the problem is gone. Yes, I am confident that we can close this issue. Thanks a lot for keeping track! 👍
I have the very same issue using a Raspberry Pi 3 Model B. Around 20 HomeKit devices (most of them DIY thermometers and Sonoff switches) and an Apple TV 4 (“HD”).
Here’s the output from
systemctl status openhab:Also, some general system info: