-
Notifications
You must be signed in to change notification settings - Fork 48
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
Prevented EBADF errors caused by closing sockets prematurely. #4
Open
justingiorgi
wants to merge
163
commits into
paulsm:master
Choose a base branch
from
justingiorgi:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a step back in some respects (re-inserting tabs that will be undone a couple patches hence), so that I can apply the patches going forward.
… causing exceptions.
…ewhere, instead of the unreliable gethostbyname(gethostname()) method (but fall back to that).
…allow for the possibility that they won't? (Or, does this even make sense with sendto()?)
tested, and this is faster.)
…t group on windows.
This is in order for the package's installation to work on Python 3.4+, solves the same issue as python-zeroconf/python-zeroconf#22.
There seems to be a bug in 0.6.x, see PyCQA/flake8-import-order#42
Prevents following exception: ``` File "/Users/paulus/dev/python/netdisco/lib/python3.4/site-packages/zeroconf.py", line 412, in __repr__ return self.to_string(self.text[:7] + "...") TypeError: can't concat bytes to str ```
The test helps making sure the situation fixed by e8299c0 doesn't happen again.
added catch of OSError added catch of socket.error for python2
IP_MULTICAST_TTL and IP_MULTICAST_LOOP socket options on OpenBSD don't accept int, only unsigned char. Otherwise you will get an error: [Errno 22] Invalid argument.
netifaces installation on Python 3.x is broken and there doesn't seem to be any plan to release a working version on PyPI, instead of using its fork I decided to use another package providing the required information. This closes python-zeroconf/python-zeroconf#31 [1] https://bitbucket.org/al45tair/netifaces/issues/13/0104-install-is-broken-on-python-3x
psutil doesn't seem to work on pypy3: Traceback (most recent call last): File "/home/travis/virtualenv/pypy3-2.4.0/site-packages/nose/failure.py", line 39, in runTest raise self.exc_val.with_traceback(self.tb) File "/home/travis/virtualenv/pypy3-2.4.0/site-packages/nose/loader.py", line 414, in loadTestsFromName addr.filename, addr.module) File "/home/travis/virtualenv/pypy3-2.4.0/site-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/home/travis/virtualenv/pypy3-2.4.0/site-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/travis/build/jstasiak/python-zeroconf/test_zeroconf.py", line 17, in <module> import zeroconf as r File "/home/travis/build/jstasiak/python-zeroconf/zeroconf.py", line 35, in <module> import psutil File "/home/travis/virtualenv/pypy3-2.4.0/site-packages/psutil/__init__.py", line 62, in <module> from . import _pslinux as _psplatform File "/home/travis/virtualenv/pypy3-2.4.0/site-packages/psutil/_pslinux.py", line 23, in <module> from . import _psutil_linux as cext ImportError: unable to load extension module '/home/travis/virtualenv/pypy3-2.4.0/site-packages/psutil/_psutil_linux.pypy3-24.so': /home/travis/virtualenv/pypy3-2.4.0/site-packages/psutil/_psutil_linux.pypy3-24.so: undefined symbol: PyModule_GetState Additionally netifaces turns out to be possible to install on Python 3, therefore making it necessary to investigate the original issue. This reverts commit dd907f2.
Zeroconf.close() immediately closed sockets which child threads may still need to finish their operations. This was causing EBADF (bad file descriptor) errors in some cases. Zeroconf.close() now blocks until all known child threads have stopped then closes the sockets safely. If a child thread was created that Zeroconf is not aware of (ie a ServiceBrowser object manually created but not registered in zeroconf.browsers) the EBADF errors may still occur. Also some of the unit tests were not in a unittest.TestCase subclass so they were not running. Added test cases to Misc TestCase and added default execution of unittest.main().
Wrong fork. Please do not merge. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Zeroconf.close() immediately closed sockets which child threads may
still need to finish their operations. This was causing EBADF (bad file
descriptor) errors in some cases. Zeroconf.close() now blocks until all
known child threads have stopped then closes the sockets safely.
Added a test and incidentally fixed some tests that weren't running.