Closed connor4312 closed 1 year ago
I hate to say this, but with the way the blocking interface in secret-service works, this is pretty much "as designed." I will take a note to mention this issue (and the workaround of using a separate thread for all keyring calls) in the docs for the secret-service keystore. Feel free to submit a PR for a suggested doc change.
@landhb and I have talked about maybe building a "native" dbus keystore (based on the dbus
crate) to avoid this problem.
I've never really considered exposing an async interface to keyring because so many of the platform native keystores are synchronous. It feels like it would be disingenuous to claim the API was async when every call to every keystore other than secret-service would either block the runtime or spin up a separate thread to do the work. We might as well force the async client to spin up that thread (like we do now with secret service), so the client has control.
Yea, that's understandable. It's just unfortunate that this is a hidden problem that only pops up at runtime on Linux. Maybe something that could be done in secret-service, if using tokio as a runtime, is calling Handle::try_current()
and then automatically running on another thread if that is Ok.
Feel free to file a secret-service issue and PR if you think you have an idea about how this could be done safely.
Calling
.get_password()
from within a Tokio runtime panics on Linux, using thelinux-secret-service-rt-tokio-crypto-openssl
feature.One workaround, which I'll probably take on my end, is to spawn the operation on another thread. A better but viral change would be exposing async methods to avoid zbus' blocking API.
https://github.com/microsoft/vscode/issues/184792