Closed oldclock closed 3 years ago
Please try keyring ≥ 21.6.0 where #480 was merged.
After python -m pip install --upgrade keyring
to latest version, the issue is fixed.
Thanks so much !!
doesn't that just hide/delay the symptoms though? I'm not sure about the specific implementation but wouldn't a keyring service like GNOME keyring be available in Ubuntu in WSL? In which case attempting to read from it would cause either hanging or crashes as observed in https://github.com/yt-dlp/yt-dlp/issues/551
Yes, the symptom is delayed.
import keyring
do not hang now, but keyring --list-backends
command still hang for long time because it cannot find SecretService.
Should I re-open this issue ?
I have already got the answer I need, so it's up to repository owner's decision.
What backend are you going to use on WSL2? If it's SecretService backend, then you need to set up the server, for example as described in README: https://github.com/jaraco/keyring/blob/main/README.rst#using-keyring-on-headless-linux-systems
If it is a different backend, I suggest you to specify it explicitly in the configuration file: https://github.com/jaraco/keyring/blob/main/README.rst#configuring
so it sounds like for a user who doesn't know about keyring (and therefore has not configured it) and wants to use a tool which uses keyring (like yt-dlp) then either:
So as a mitigation, yt-dlp can import keyring on demand and hopefully not too many users will require keyring access in WSL, but for those that do, would it be possible to have better detection of this problem on the keyring side so that users are more informed about the problem rather than assuming that the tool they are using has a problem?
For example, perhaps if WSL is detected (using this), then set a short dbus timeout if possible to something like 5 seconds and catch dbus.exceptions.DBusException
and re-raise as something more informative like BackendConfigurationError('no keyring backend found at ... Please refer to https://github.com/jaraco/keyring/blob/main/README.rst#using-keyring-on-headless-linux-systems for configuring keyring in WSL')
I'm not sure if that's a good solution but just an idea.
Describe the bug When
import keyring
on WSL2, it hangs for long time (about 6-8 minutes on my PC) Note that this symptom only happens whenDISPLAY
variable is set in WSL2 but no X-server is running on Windows. Ifctrl+c
then log shows that the issue is related to dbus:There are two work-arounds I have found:
unset DISPLAY
orAny of them can work-around this symptom.
To Reproduce Steps to reproduce the behavior: Enter the following commands on WSL2
Expected behavior It should not take long time.
Environment
Additional context Please refer to yt-dlp/yt-dlp#551 for more discussion history.