microsoft / vscode-postgresql

PostgreSQL extension for VSCODE
Other
422 stars 53 forks source link

Problem with disrupted Postgres Connection. Unable to reconnect #79

Open groksrc opened 4 years ago

groksrc commented 4 years ago

Issue Type: Bug

When my laptop loses connection to the internet (like hibernate/wake), the connection is disrupted. When I try to run the query in this state it prompts me to reconnect, which I do. However, when I run the query again I see the error:

Execution failed due to an unexpected error: 
Another query is currently executing.
Total execution time: 00:00:00

I cannot re-establish the connection. Instead I have to close the query window and start a new one.

The only databases I use are Postgres, I don't know if this happens to other providers.

Azure Data Studio version: azuredatastudio 1.15.1 (83544eba2504f564d785534cc780d2073feec2cc, 2020-02-15T05:01:39.777Z) OS version: Darwin x64 18.7.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2600)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|2, 2, 2| |Memory (System)|16.00GB (0.26GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (1) Extension|Author (truncated)|Version ---|---|--- azuredatastudio-postgresql|Mic|0.2.4
Toadie1 commented 4 years ago

I have same behavior - and it is very annoying.

daz10000 commented 4 years ago

Same problem - can create this when postgres instance restarts, or when connected over a vpn and it goes down/up - basically any network interruption. This renders azure data studio + postgres barely usable. Have tried lots of ways of resuscitating the query window. Disconnecting and reconnecting results in the same error message (despite reconnection). One would imagine the disconnection results in ending any running queries; Creating a new query window will usually revive it but sometimes it gets into a state where it appears to run the query but produces no results (no rows). This can sometimes fool you into thinking it's working again but query returns no result then you start a whole new session and realize the results were just wrong. You need to go over all the connection management code very carefully - tool is not really usable in its current state and this has been going on for at least a year. I just keep expecting it to get fixed ;(

Execution failed due to an unexpected error: 
Another query is currently executing.
linsmod commented 4 years ago

same error shows, but in my case , the network is always online.

kburtram commented 4 years ago

Is this issue only occurring with Postgres connections?

linsmod commented 4 years ago

Is this issue only occurring with Postgres

in my case yes. should find out which component says Another query is currently executing.

daz10000 commented 4 years ago

I have only ever connected to Postgres instances

Von meinem iPhone gesendet

Am 03.04.2020 um 5:48 PM schrieb Tiny notifications@github.com:

 Is this issue only occurring with Postgres

in my case yes. should find out which component says Another query is currently executing.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

blackTay commented 4 years ago

Same problem here with postgres, when the network connection resets. Only workaround seems to be to save the current file and restart Azure. This is serious in combination with bug microsoft/azuredatastudio#10120 , where a new connection to postgres for a previously saved file is impossible.

amadeogallardo commented 4 years ago

Same issue here, restarting Azure Data Studio seems to be the only way to reliably re-establish the connection.

kburtram commented 4 years ago

I'll move this to vscode-postgresql since this is where the Postgres connection logic is implemented.

alainkaiser commented 4 years ago

Same problem as @daz10000 described.

Execution failed due to an unexpected error: Another query is currently executing.

cdeil commented 4 years ago

36 might be the same issue?

For me, I have flaky internet connection, and after a short dropout the PostgreSQL extension with latest Azure data studio seems to go into a bad state.

The error message is "another query is executing", but there's no way to see which other query is executing?

Using CMD+SHIFT+P and then "Cancel query" seems to have no effect.

@akamath46297 @ravindrakreddy - can you reproduce the issue?

Screenshot 2020-06-10 at 19 08 35

rhollins commented 4 years ago

Same here in Azure Data Studio when connecting to Azure PostgreSQL over express-route and private endpoints.

jnorinder commented 4 years ago

I have the same problem. Connecting to a postgres in a Docker container. I need to disconnect from postgres database and then delete the connection and then create a new connection to the database.

Also, the connection closes after some time of inactivity. Am I missing something or is it possible to set the connection timeout value anywhere?

cdeil commented 4 years ago

I switched to https://dbeaver.io/, seems to work well.

knguyen1794 commented 4 years ago

I switched to https://dbeaver.io/, seems to work well.

I agree to this. DBeaver is just so much better than Azure Data Studio. From autocomplete, code formatting, to number of databases supported, etc.

cocowalla commented 4 years ago

I'm having the same issue, also only with Postgres.

At first it works fine. But if I leave Data Studio open for a while without doing any queries, the connection is dropped (says it was disconnected when I next try to query). After reconnecting and trying to query, I will always get this error:

Execution failed due to an unexpected error: 
Another query is currently executing.

Only restarting Data Studio seems to help - it is incredibly annoying!

bt-88 commented 4 years ago

I'm having the same issue, also only with Postgres.

At first it works fine. But if I leave Data Studio open for a while without doing any queries, the connection is dropped (says it was disconnected when I next try to query). After reconnecting and trying to query, I will always get this error:

Execution failed due to an unexpected error: 
Another query is currently executing.

Only restarting Data Studio seems to help - it is incredibly annoying!

Exactly the same here. Only restarting Data Studio works. (Windows 10, Postgres 11)

clement128 commented 4 years ago

Same here

Ettery commented 3 years ago

I'm experiencing the same after having to re-establish a connection to Postgres on AWS

katjakoka commented 3 years ago

The same. Maybe it is high time to solve it? ^_^

davepreston commented 2 years ago

seems to be the same issue for me. My only workaround is to Disconnect and reconnect the DB every time I switch away from using AZ Data Studio. If I gamble and try to run a query when it has lost it's connection it takes 30ish seconds before I disconnect/reconnect :(. What other tools have others been using for postgres? I'm about ready to try something new.

jnorinder commented 2 years ago

I can recommend either pgAdmin or DBeaver Community. DBeaver is the one I use the most.

daz10000 commented 2 years ago

I don't use azureDS much mainly due to this issue. I often end up using pgsql - and actually really like pgcli as another command line option. Have tried vscode plugins, pgadmin, (have used dbeaver historically and it's pretty good - leaks memory IMHO), and people swear by datagrip but that's a commercial option

ChrisMagnuson commented 5 months ago

Same issue still occurring when using the postgresql VSCode plugin.

One thing I have noticed is that if I know the network has been disconnected and then make sure it is connected again (VPN, SSH tunnel, etc.) then in VSCode run PostgreSQL: Connect manually before executing a query, then I am able to run queries again without getting the error and without having to close and reopen VSCode.

If I don't realize that I have been disconnected and then try to run a query one time and it errors out, then there is no way to get errors to stop until restarting VSCode.

Not great but might help others as if you know your computer went to sleep, hibernate, the vpn disconnected, etc. then you can manually reconnect in the tool your using before executing any query and then not have to restart it.

I assume there is a way to do this for Azure Data Studio similarly to how I am doing it in VS code but I don't use that tool so someone else will have to confirm that.