GoogleCloudPlatform / guest-oslogin

OS Login Guest Environment for Google Compute Engine
https://cloud.google.com/compute/docs/oslogin/
Apache License 2.0
96 stars 47 forks source link

bash autocompletion slow #136

Closed brendene closed 4 months ago

brendene commented 5 months ago

Hello,

It looks like after this patch: https://github.com/GoogleCloudPlatform/guest-oslogin/pull/117/commits/ef11bfefc0d55e4528a40ac83b5da0923b5b3d55

The bash autocompletion on certain strings waits for the full 3 second timeout. This is on a a stock gcp vm running the latest debian image.

$ time ls ~*
ls: cannot access '~*': No such file or directory

real    0m3.066s
user    0m0.002s
sys     0m0.001s

It looks like the underlying http request to the metadata server is:

$ curl -v "http://metadata.google.internal/computeMetadata/v1/oslogin/users?username=%2A" -H "Metadata-Flavor: Google"
*   Trying 169.254.169.254:80...
* Connected to metadata.google.internal (169.254.169.254) port 80 (#0)
> GET /computeMetadata/v1/oslogin/users?username=%2A HTTP/1.1
> Host: metadata.google.internal
> User-Agent: curl/7.88.1
> Accept: */*
> Metadata-Flavor: Google
> 
< HTTP/1.1 400 Bad Request
< Metadata-Flavor: Google
< Date: Mon, 13 May 2024 18:35:47 GMT
< Content-Type: text/html
< Server: Metadata Server for VM
< Content-Length: 288
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< 
[ReqId=....] Error Details: Username is not POSIX compliant.

Should retry logic be disabled on these types of errors in addition to 404?

mgabeler-lee-6rs commented 4 months ago

Observed the same issue. Several other commands are also made extremely slow, or slow to start, due to this issue. Seems to impact anything that looks up passwd (user) entries.

brenden-covariant commented 4 months ago

I submitted this issue here as well: https://issuetracker.google.com/issues/340606657

a-crate commented 4 months ago

Thanks for the report. This fix will be included in the next release.

mgabeler-lee-6rs commented 4 months ago

Thank you! I see a source release was made. What is the cadence of updating the apt repo that drives updated binaries being available on the actual VMs?

a-crate commented 4 months ago

We don't have a set cadence for releases, but I will be starting the release process on Monday the 1st and it will take 3 weeks for the package to fully roll out to the public. You can expect it to be available everywhere in the compute engine apt repo by the 19th.

brendene commented 2 months ago

Thank you for the fix, I can confirm that on the projects/debian-cloud/global/images/debian-12-bookworm-v20240815 image the issue has been resolved.