cli
cli copied to clipboard
`pscale` hangs for 2 minutes when running in WSL2
Hi!
I noticed a strange behavior when running pscale
in WSL2.
- Release 0.131.0
- Installed via
pscale_0.131.0_linux_amd64.deb
- WSL2
Ubuntu 20.04.6 LTS
Any command will hang for 2 minutes before any output:
$ time pscale --debug org list
Updater error: skipping update, reason: Latest version was already checked
Error: not authenticated yet. Please run 'pscale auth login'
Error: --access-token is required for access token authentication
________________________________________________________
Executed in 120.11 secs fish external
usr time 4.44 millis 51.00 micros 4.39 millis
sys time 4.83 millis 114.00 micros 4.72 millis
Running pscale auth login
will take 2 minutes until a browser window with the (correct) code is opened and then another ~2 minutes until a success message is shown.
$ time pscale --debug auth login
Confirmation Code: xxx
If something goes wrong, copy and paste this URL into your browser: https://auth.planetscale.com/oauth/device?user_code=xxx
Successfully logged in.
________________________________________________________
Executed in 275.68 secs fish external
usr time 250.22 millis 0.00 micros 250.22 millis
sys time 111.74 millis 770.00 micros 110.97 millis
I cannot connect to any database or do any development work in WSL2.
Happy to debug this further with some guidance.
Just chiming in to say that I'm observing this issue as well in WSL2, running the same version of Ubuntu but using pscale
version 0.136.0 at time of writing. There are two details worth mentioning, though:
- The first command after a reboot works as expected, but every command after that takes ~2 minutes
- I can connect to databases and branches, they are just subjected to the same 2 minute restriction
This issue isn't really a blocker for me because all of the commands work eventually, but it does make demoing Planetscale for my team pretty painful.
Also having this same behaviour with [email protected]
installed via brew
on Ubuntu 20.04.4 in WSL2.
First command runs as normal. Subsequent commands hang for ~2 minutes before doing anything.
I haven't been able to recreate this yet. Our suspicion is that this has to do with keyring access.
If someone here gets a chance, could you try running pkill gnome-keyring
? Then run the pscale command again. I'm curious if that temporarily improves it.
Related issue: https://github.com/99designs/keyring/issues/112
@mscoutermarsh I can confirm that in my instance, this worked:
gurlr on main [✘!?] is 📦 v0.1.0 via ⬢ v16.20.0 took 4s
➜ time pscale --help
<snip output>
pscale --help 0.01s user 0.00s system 0% cpu 2:00.11 total
gurlr on main [✘!?] is 📦 v0.1.0 via ⬢ v16.20.0 took 2m 0s
➜ pkill gnome-keyring
gurlr on main [✘!?] is 📦 v0.1.0 via ⬢ v16.20.0
➜ time pscale --help
<snip output>
pscale --help 0.01s user 0.00s system 0% cpu 3.215 total
@itsjxck wow, thank you. Will keep looking into the keyring then.
Thanks for looking into this! I can confirm the same behavior with gnome-keyring
.
Killing it after each pscale
command "works".
That partially solves the problem for me. It reduced the time from four minutes down to two minutes. Apparently there is something else going on too.
~/repositories time pscale --version
pscale version 0.136.0 (build date: 2023-04-05T18:22:00Z commit: bd872ad)
real 4m12.467s
user 0m0.013s
sys 0m0.000s
~/repositories pkill gnome-keyring
~/repositories time pscale --version
pscale version 0.136.0 (build date: 2023-04-05T18:22:00Z commit: bd872ad)
real 2m10.787s
user 0m0.006s
sys 0m0.008s
~/repositories
Great info, thank you.
@mscoutermarsh, if there is other information that would be helpful ... let me know. Also, if the source code is available (is it open source?), I would be willing to run it in a debugger.
Um. NVM, I see the code is here, in this repo. Duh.
@iambillmccann That'd be incredible! No one on our team has been able to reproduce it just yet.
We believe it's likely timing out when accessing the keyring here: https://github.com/planetscale/cli/blob/37460efe0a564dc44d4ec85918f75139389489ce/internal/config/config.go#L214
Or it may be when reading/writing it. https://github.com/planetscale/cli/blob/37460efe0a564dc44d4ec85918f75139389489ce/internal/config/config.go#L237
Related issue: 99designs/keyring#112
Fwiw, I don't think this issue is just related, but it's exactly this problem that we're hitting here. @iambillmccann You probably end up debugging that package when following the bread crumbs. But if you have any information for us, or for them that would be amazing!
I'm having the same issue. CLI version: 0.144.0 Ubuntu version: 22.04.2 (WSL2)
Running pkill gnome-keyring
before each command also seems to be working for me.
If there is anything I could help you debugging let me know.
I've put an alias in my .bashrc
as workaround:
alias pscale="pkill gnome-keyring && pscale"