OpenLightingProject / ola

The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
https://www.openlighting.org/ola/
Other
634 stars 202 forks source link

ArtNet socket isn't released on shutdown on OS X #455

Open nomis52 opened 9 years ago

nomis52 commented 9 years ago

This is really weird, once olad exits, the Artnet UDP socket (6454) is still present. If you restart olad again it fails to receive ArtNet messages. You can see it show up with:

$ netstat -n -f inet | grep 6454 udp4 0 0 .6454 *.

The udp_server example doesn't have this issue, nor does the E1.31 socket on port 5568 doesn't have this problem so it's something specific to how we're using the ArtNet socket.

nomis52 commented 9 years ago

More info:

I can't reproduce the problem if I use ArtNetNode directly, it's only when it's used with olad. I can't reproduce the problem if I change the port to something other than 6454 I can't reproduce the problem with the ESPNet plugin.

I wonder if it's not the act of sending an ArtPoll or some other data.

nomis52 commented 9 years ago

Ok, I've made some progress. The problem only exists if the firewall is enabled. If I disable the firewall and then run olad netstat doesn't show the socket once olad terminates.

Very weird.

peternewman commented 9 years ago

The linux command is netstat -n -A inet | grep 6454, but it sounds like you've isolated it to a Mac issue.

nomis52 commented 9 years ago

I'm slowly getting to the bottom of this:

It's caused by starting the HTTP thread. If you run with --nohttp the problem doesn't occur. Starting an mDNS thread also doesn't cause the problem.

nomis52 commented 9 years ago

Steps to repro:

nomis52 commented 9 years ago

I can't figure this out, I've posted on stack overflow: http://stackoverflow.com/questions/25586327/bizarre-firewall-related-socket-leak-on-mac-os-x

jmarsico commented 8 years ago

Hi @nomis52, Did you ever find a solution? I'm using libartnet in an openFrameworks project and seem to have the same issue on OSX 10.10.

nomis52 commented 8 years ago

Nope, it's very odd. I suspect it's a OS X kernel bug.

jmarsico commented 8 years ago

have you figured out a workaround?

nomis52 commented 8 years ago

Try disabling the OS X firewall.

nomis52 commented 7 years ago

Someone replied on the stack overflow thread

http://stackoverflow.com/questions/25586327/bizarre-firewall-related-socket-leak-on-mac-os-x/42847513#42847513

zonque commented 5 years ago

Just bumped into this as well, and posted some more findings as reply to the Stackoverflow issue linked to above. There seems to be no fix for this, hence you need to disable the firewall.

peternewman commented 5 years ago

Thanks for replying here @zonque . @nomis52 did you raise a ticket with Apple at the time, if so they might appreciate @zonque 's simplified case to replicate it, although I wouldn't hold out much hope.