GoogleCloudPlatform / cloud-code-intellij

Plugin to support the Google Cloud Platform in IntelliJ IDEA - Docs and Issues Repository
Apache License 2.0
318 stars 59 forks source link

Database content not loading #3176

Closed villesau closed 3 months ago

villesau commented 6 months ago

(Please ensure you are running the latest version of Cloud Cloud IntelliJ with Help > Check for Updates.)

(screenshots are often helpful)

Expected Behavior

  1. connect to the database via IntelliJ + proxy (Google Cloud Databases)
  2. wait for The proxy has started successfully and is ready for new connections!
  3. open databases
  4. select table you want to see
  5. It loads the table content

Actual Behavior

  1. connect to the database via IntelliJ + proxy (Google Cloud Databases)
  2. wait for The proxy has started successfully and is ready for new connections!
  3. open databases
  4. select table you want to see
  5. It gets stuck on "Processing"

Additional Information

Note that this has been a long standing issue (maybe forever?), but also with the latest versions. However, previously it happened randomly, now it happens every time.

villesau commented 6 months ago

Actually, it might still eventually connect. But it takes 10+minutes:

2023/12/22 10:18:12 The proxy has started successfully and is ready for new connections!
2023/12/22 10:29:25 [retracted] accepted connection from <ip-address>
ivanporty commented 6 months ago

Thanks @villesau! We cannot reproduce this and connection is instant for us so the reason might be in communication between GCP and your local client - depending on the database region, database instance type, etc. Does it reproduce if your create another database instance or use another Cloud SQL database type?

villesau commented 6 months ago

I'm not the only one this happens to. Also my colleague is having similar problems. We are physically quite close to the data center (definitely not 10 minutes away light speed...). The DB is performant in prod. We are using managed postgres.

ivanporty commented 6 months ago

This might be something related to the proxy version or its performance. If you have a chance, could you please try with the newest version of proxy from here https://github.com/GoogleCloudPlatform/cloud-sql-proxy/releases, copying the command line Cloud Code generates in the terminal when you establish a connection, and see if this makes any difference?

villesau commented 5 months ago

Oh, indeed when trying out with the latest version and manually running the script the connection was instant! 🤯 This is not the case with the latest one that ships with the gcloud toolset.

ivanporty commented 5 months ago

Thanks for confirming this! We'll schedule Cloud SQL proxy update for the next release and hopefully this will get rid of latency issues.

pouyan021 commented 5 months ago

I confirm this happens to me as well. Also, it makes the whole intellij freeze completely, I have to 'force quit' it and reopen to continue doing my job. I knew this issue existed in at least the last 3-4 versions of the plugin and I would run the command from a casual terminal instance to make the connection. Tried my luck again today and the odds were not in my favor

villesau commented 5 months ago

Also, it makes the whole intellij freeze completely, I have to 'force quit' it and reopen to continue doing my job.

This happens (or happened, not sure yet with the latest proxy) to me too, but I'm not been able to 100% pinpoint it to cloud code.

pouyan021 commented 5 months ago

Also, it makes the whole intellij freeze completely, I have to 'force quit' it and reopen to continue doing my job.

This happens (or happened, not sure yet with the latest proxy) to me too, but I'm not been able to 100% pinpoint it to cloud code.

There's something to do with this plugin. Running the command in a separate terminal and coming to IntelliJ and trying to connect has always worked seamlessly for me, but the minute I try to connect the db in Intellij after establishing a connection using the plugin, the same disaster happens again regardless of the version of the ide or the plugin (at least for the last 3-4 releases as I mentioned, because I remember a time when this wasn't happening)

ivanporty commented 5 months ago

Thanks for the report @pouyan021. This might be a system specific error when terminal doesn't respond - we do look for terminal output and process status and it might vary from system to system. Could you please tell us your IDE, OS, and plugin version?

pouyan021 commented 5 months ago

Thanks for the report @pouyan021. This might be a system specific error when terminal doesn't respond - we do look for terminal output and process status and it might vary from system to system. Could you please tell us your IDE, OS, and plugin version?

I'm on a MacBook Pro 2019 CPU: intel core i9 os: Sonoma 14.2.1 IDE: IntelliJ IDEA 2023.3.2 plugin: 23.12.3-api-version-223

pouyan021 commented 3 months ago

Just checked randomly today and seems this happens no more

ivanporty commented 3 months ago

Thanks for double checking. Will close and please reopen if happens again. We now do automatic Cloud SQL Proxy updates each release and that should help with any related issues.