hap-java / HAP-Java

Java implementation of the HomeKit Accessory Protocol
MIT License
152 stars 83 forks source link

Operation not permitted at java.net.PlainDatagramSocketImpl.send #39

Open vietk opened 6 years ago

vietk commented 6 years ago

Hello, Since I am using HAP installed on RPI into a docker container, I always had all my accessories not responding after some hours or days. So I raised some log level here and there and I spotted (3 or 4 times) this exception at the exact time where all the accessories started to not answer

2017-12-08 00:28:34.725 [WARN ] [javax.jmdns.impl.tasks.Responder ] - Responder(192-168-0-106.local.)run() exception java.io.IOException: Operation not permitted (sendto failed) at java.net.PlainDatagramSocketImpl.send(Native Method)[:1.8.0_131] at java.net.DatagramSocket.send(DatagramSocket.java:693)[:1.8.0_131] at javax.jmdns.impl.JmDNSImpl.send(JmDNSImpl.java:1612)[16:javax.jmdns:3.5.2] at javax.jmdns.impl.tasks.Responder.run(Responder.java:154)[16:javax.jmdns:3.5.2] at java.util.TimerThread.mainLoop(Timer.java:555)[:1.8.0_131] at java.util.TimerThread.run(Timer.java:505)[:1.8.0_131] 2017-12-08 00:28:40.896 [INFO ] [.hap.impl.http.impl.AccessoryHandler] - Terminated homekit connection from /192.168.0.61:49762

It looks like there's a bug in jmDNS or a bad usage of it in HAP. Some sources on the internet are saying it's probably that too much data is sent through the socket, but I hardly believe that HAP sends a ton of data when responding to a ios device. I tend to believe it's probably a concurrency issue.

What do you think ?
Regards Kevin