DaxStudio / DaxStudio

DAX Studio is a tool to write, execute, and analyze DAX queries in Power BI Desktop, Power Pivot for Excel, and Analysis Services Tabular.
http://daxstudio.org
Other
677 stars 143 forks source link

Please reconnect to the same database if connection is dropped (automatically if possible) #356

Closed o-o00o-o closed 3 years ago

o-o00o-o commented 4 years ago

Describe the bug Right now, often the connection is dropped after a period of timeout. When I then reconnect on a server with multiple databases, usually my experience is that it will connect to a different database and not the one that I was previously connected to. This issue is made worse as DaxStudio forces the user to wait for metadata to be fully loaded before allowing any changes to database or executing any query. With a big cube with thousands of measures/columns that takes 45 seconds to connect and refresh metadata it means that if the connection is dropped, trying to reconnect to the same database again takes twice as long as it should and requires a carefully co-ordinated sequence of actions which feels very inefficient of time.

To Reproduce

Expected behavior

Screenshots NA

Additional context NA

dgosbell commented 4 years ago

Duplicate of #348 and #349

dgosbell commented 4 years ago

How do you know the connection has dropped? Do you get an error or warning? Do you only see issues when attempting to run a query or does it happen when you alt-tab or click back on DAX Studio after using another app?

Can you have a look at starting DAX Studio with the diagnostic logging enabled, reproduce this issue and post the logs back to this issue along with some information on the rough time you noticed the need to reconnect? I don't currently have a good repro for this, I have access to one example model with over 11,000 measures and it only takes 5-8 seconds to load the metadata.

Are you seeing this same behaviour from other tools? How long does it take Power BI Desktop to connect to this model? Does it also loose the connection after a period of time?

o-o00o-o commented 4 years ago

So, this is what happened today. I did some queries on a connection. Went out for a few hours, came back and reran the query

image

Returned with an error Run, Connect and Refresh Metadata are all available (not greyed out)

When I ran query again, it did connect to the same database and did just run, so this is working as expected.

Not sure if this changed since the last version (I'd just upgraded to 2.11.1), but before I'm sure it always greyed out the run once it returned an error on the connection, so I was forced to use the Connect button again and that didn't connect back to the same Database

So now testing that, I then hit connect, it still changes the database to be a different database. Not sure why it chose the second one down from the list of available ones?

image

So I think perhaps the Run->Timeout->Run case is now solved,

Thinking about it, pretty much all AS tools ask you up front which database to connect to before they then try to load the metadata, so it would be good if DaxStudio worked the same way. Even so, it would be good for it to default to selecting the last one that you connected to. I think that would solve the other issue with it not connecting to the database that I want it to connect to (and having to wait while it picks the wrong one)

Power BI does take a while to load our model. I never remember it timing out on me

o-o00o-o commented 4 years ago

here is another case. I connected and went away and did something else. Now I am in the state where I can't do anything and this window is now useless as neither Run, Conect, Refresh Metadata is available

image

When I clicked the Help to get to the Issues list, it then did a metadata refresh (for some reason). But still neither Conect or Run are available

image

Really need to be able to just resume a broken connection rather than having to close the query and reopen (and again have to wait synchronously while the metadata is refreshed).

dgosbell commented 4 years ago

So that second issue is also logging a connection lost error also. So if I can build in an automatic re-connect mechanism this should fix both scenarios.

dgosbell commented 3 years ago

This should be fixed in the recent 2.13 release. I've completely re-built the internal connection management in order to incorporate automatic reconnection.