-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
dvc: pretty slow on Mac #2582
Comments
p.s. My connection is pretty fast, no VPN, and I've experienced this on several different networks recently (residential, WeWork, cafes, hotel). |
Tried adding sleep(100) to places where |
Yeah still happening on my machine with the latest DVC version. I ran But oh well, as long as this is a problem only on my machine then it's not really an issue, right? Feel fee to close unless you want to investigate further. Glad to give you SSH access or something. |
@jorgeorpinel No reason to close this, we don't know if it is happening to anyone else, but they are just stopping using it without reporting the issue :) Let's have a meeting together, so I could take a look, maybe it is something obvious that I'm missing. I'll ping you in PM's. Thank you 🙂 |
We've had a debugging session with @jorgeorpinel and found that it is |
Ok, so turns out on Mac "Computer name" that you set in |
Ok, so it is a cpython bug https://bugs.python.org/issue5004 . There is a patch for it from like 9 years ago. We can either monkeypatch it or patch it in flufl.lock and or try to push this fix into cpython as well. Working on this right now. |
Thanks for looking at this Ruslan! Glad there's a workaround we can use in |
For the record, submitted a PR https://gitlab.com/warsaw/flufl.lock/merge_requests/12 . @jorgeorpinel confirmed that it works for him now. |
Workaround for slow and obsoleted gethostbyaddr used in `socket.getfqdn()`. See [1], [2] and [3] for more info. [1] https://bugs.python.org/issue5004 [2] iterative#2582 [3] https://gitlab.com/warsaw/flufl.lock/merge_requests/12 Flufl.lock guys seem unresponsive, so we have to monkeypatch this by ourselves, at least for now. Fixes iterative#2582
Workaround for slow and obsoleted gethostbyaddr used in `socket.getfqdn()`. See [1], [2] and [3] for more info. [1] https://bugs.python.org/issue5004 [2] #2582 [3] https://gitlab.com/warsaw/flufl.lock/merge_requests/12 Flufl.lock guys seem unresponsive, so we have to monkeypatch this by ourselves, at least for now. Fixes #2582
@jorgeorpinel 0.63.3 is out. Please upgrade 🙂 |
Nice! It's fast now before output but still around 13 seconds to get back to the console prompt AFTER the command output, whether with or without analytics... Here's the profiler output: https://pastebin.com/isBDYC4E |
@jorgeorpinel Ok, this time this seems to be OS X fault for not caching dns requests rust-lang/rust#31665 . Will prepare a workaround ASAP. |
Aaaand I can fully reproduce the original issue but now with getaddrinfo on my conda on mac 😬 Looking into that... |
This is basically Lock.__init__ copy-paste, except that instead of using `socket.getfqdn()` we use `socket.gethostname()` to speed this up. We've seen [1] `getfqdn()` take ~5sec to return anything, which is way too slow. `gethostname()` is actually a fallback for `getfqdn()` when it is not able to resolve a canonical hostname through network. The claimfile that uses `self._hostname` is still usable, as it uses `pid` and random number to generate the resulting lock file name, which is unique enough for our application. [1] iterative#2582 Fixes iterative#2582
@jorgeorpinel Could you please install
and see if that helps? It works for me, but I just want to make sure. |
Ran that (with
|
@jorgeorpinel Thanks! I think we have a separate issue for those. |
This is basically Lock.__init__ copy-paste, except that instead of using `socket.getfqdn()` we use `socket.gethostname()` to speed this up. We've seen [1] `getfqdn()` take ~5sec to return anything, which is way too slow. `gethostname()` is actually a fallback for `getfqdn()` when it is not able to resolve a canonical hostname through network. The claimfile that uses `self._hostname` is still usable, as it uses `pid` and random number to generate the resulting lock file name, which is unique enough for our application. [1] #2582 Fixes #2582
I experience around 10 seconds before and another 5 to 10 after
dvc version
output (below) on my Macbook Air.Attached are a couple logs of
python3 -mcProfile -s cumtime -m dvc version
, the second one after opting out from analytics:python3 -mcProfile -s cumtime -m dvc version (with analytics).log
python3 -mcProfile -s cumtime -m dvc version (without analytics).log
The text was updated successfully, but these errors were encountered: