-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZeroConf() returns OSError: [Errno 48] Address already in use #967
Comments
Can you post some more information about your network setup? The default is to use on all network interfaces. You may need to limit that down to avoid the error. I'm able to use it on my m1 laptop without the error but I don't have anything special setup. |
Running into the same issue on FreeBSD.
More information:
Is this related?
Any ideas how to fix this? |
Can you try making the socket manually by calling https://github.com/jstasiak/python-zeroconf/blob/master/zeroconf/_utils/net.py#L214 and seeing where you hit the error? |
Thanks @bdraco - could you give me a concrete example on how to do this please? I should probably mention that If I quit that, I don't get the "Address already in use" error. Can only one Zeroconf client/browser be active on the same machine? |
Are you by chance running in docker or have a docker file that replicates the issue? |
I had the same issue (macOS Big Sur 11.5.2) and was able to resolve the issue. The problem was indeed Apple's mDNS responder daemon. To fix the issue:
Should return
Hope this helps someone. |
closed via #1028 |
Using zeroconf-0.37.0, still getting "Address already in use" when running the browsing example from the README on a machine on which Avahi is running.
The problem only exsists if |
We only trap errno 49. Looks like your system throws 48 |
We could trap 48 as well but I don't think it will actually solve the issue as it's likely avahai is getting exclusive use of the port |
I'd be happy to test if you tell me how. Thanks! |
If you adjust this line to trap Errno 48 https://github.com/jstasiak/python-zeroconf/blob/master/zeroconf/_utils/net.py#L250 that should be a good test |
It should be |
|
It looks like its not going to be able to listen while avahai is running since its getting exclusive use of the socket unless we have the flags wrong for sharing the port for FreeBSD. Unfortunately, I'm not a FreeBSD user so I can't comment on that. |
Does it work e.g., on Linux systems? |
I believe the code may not have the right flags. See: FWIW, one need not install FreeBSD in order to read it's documentation, but if you wish to do so for testing, it should be fairly easy to setup a VM: https://download.freebsd.org/ftp/releases/VM-IMAGES/13.0-RELEASE/amd64/Latest/ |
I run into this now from time to time. I only see it because I cranked up logging defaults. I'm on macOS 10.15.7. Things seem to work out anyway, and stuff is advertised as expected. |
We need to normalize the use of SO_REUSEADDR/SO_REUSEPORT since every OS seems to implement it slight differently. Its a bit of a portability nightmare https://medium.com/uckey/the-behaviour-of-so-reuseport-addr-1-2-f8a440a35af6 |
It appears to be undocumented, but FreeBSD does not allow reuse of ports by software running as a different user. You can test this by running avahi-daemon with --no-drop-root and it'll suddenly start happily sharing the port. If you want to use SO_REUSEPORT, all the binding software must run under the same UID. |
I can confirm that this is also true on macOS. And sorry, but disabling a macOS system service is obviously not a solution but at most a temporary workaround until a proper solution has been implemented. |
Zeroconf() fails on instantiation with OSError: [Errno 48] Address already in use
The code works perfectly well on Ubuntu 21.04 but fails with the following error on macOS Big Sur version 11.5 :
` ``csh
As you can see
Zeroconf()
just creates an instance of the Zeroconf class. Neither Port nor IP address has been specified.The text was updated successfully, but these errors were encountered: