New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After automatic update, run heidisql.exe with normal privileges, not as admin #418

Open
dejury opened this Issue Nov 30, 2018 · 15 comments

Comments

Projects
None yet
2 participants
@dejury

dejury commented Nov 30, 2018

Steps to reproduce this issue

Connect using plink.exe to a database. After that, check if there are updates for HeidiSQL. If there are available, install them. HeidiSQL closes and installs the update. Afterwards, HeidiSQL bootes up again. Then it is not possible to connect via SSH again...

Only after a reboot of HeidiSQL it is possible again.

Current behavior

The SSH connection is not closed correctly, which makes it unavailable after reboot of the application.

Expected behavior

It should be reset.

Possible solution

To make it close or reset the connection on update

  • HeidiSQL version:
    9.5.0.5357
  • Database system and version:
    MariaDB 10.1.35
  • Operating system:
    Windows 10, October Update 2018
@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Nov 30, 2018

The SSH connection is not closed correctly, which makes it unavailable after reboot of the application.

If the plink.exe process is still running, HeidiSQL just creates another process using the next higher port for connecting.

Maybe there are other reasons why Heidi does not connect. What error message do you get in such cases? Is there something in the log?

@dejury

This comment has been minimized.

dejury commented Dec 3, 2018

It looks like the plink.exe process is closed during the update. I looked that up into the processlist.
But it seems that somehow, after update, the first time it boots. It doesn't fire the plink.exe process, which gives an error. See attached.

When I close HeidiSQL again, and then start again. It works without a problem.

after-update-error

@dejury

This comment has been minimized.

dejury commented Dec 3, 2018

I looked the #10061 error up on the internet. It is that the target computer actively refused the connection.

Good to know, which maybe has something to do with the bug. The SSH server is running on an other port then 22.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Dec 3, 2018

You should have a look at the log panel - is there something when that error occurs?
Does a new attempt to connect work? Or do you need to restart HeidiSQL to get it working?

@dejury

This comment has been minimized.

dejury commented Dec 4, 2018

You should have a look at the log panel - is there something when that error occurs?

In the Windows logs there is nothing. I enabled HeidiSQL logging into file with debugging on, but there are no new nightly builds, so I cannot try yet. Will do that after an update is available ;)

Does a new attempt to connect work? Or do you need to restart HeidiSQL to get it working?

A new attempt does not work, you need to restart HeidiSQL to get it to work again.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Dec 4, 2018

If after a nightly build update something does not work, that may have to do with the new heidisql.exe process being started with administrator privileges. That is due to the external updater, which gets started elevated, and the updater then starts heidisql.exe with the same privileges. That is probably fixable if the updater is able to run heidisql with normal privileges again.

For testing purposes, you could download an older build from heidisql.com, then start an update to the current build.

I am myself also experiencing an issue with connecting after an update, but in a different way than you did: on the first run with admin privs, I see a blank list of sessions, where there are ~20 sessions when I run it with normal privs.

Here's a probably helpful post.

@dejury

This comment has been minimized.

dejury commented Dec 4, 2018

If after a nightly build update something does not work, that may have to do with the new heidisql.exe process being started with administrator privileges. That is due to the external updater, which gets started elevated, and the updater then starts heidisql.exe with the same privileges. That is probably fixable if the updater is able to run heidisql with normal privileges again.

For testing purposes, you could download an older build from heidisql.com, then start an update to the current build.

I am myself also experiencing an issue with connecting after an update, but in a different way than you did: on the first run with admin privs, I see a blank list of sessions, where there are ~20 sessions when I run it with normal privs.

Here's a probably helpful post.

Will give this a try tomorrow. I don't think it is only a problem for nightly builds, I think it is also for the "normal" updates.

Will update you with a status tomorrow.

@dejury

This comment has been minimized.

dejury commented Dec 5, 2018

I did an update and attached the logs below.

000001.log is the session which started the update
000002.log is the session which started right after the update, and can't connect via SSH
000003.log is the session after a restart of HeidiSQL, which succesfully connects

I replaced senstive data with
<username@server> & <portnumber>

000001.log
000002.log
000003.log

ansgarbecker added a commit that referenced this issue Dec 5, 2018

Force a minimum of 1 second waiting time after creating the plink.exe…
… process before trying to access the established tunnel. Could help users which have set it to "0", accidentally or intentionally, and experiencing connection problems with that. Related to #418.
@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Dec 5, 2018

Activating that logging to file with debug messages was a really good idea. Reveals a lot of useful details. Of course that could be a bit less verbose when logging usernames, hostnames and such things.

The logs say you have set a timeout of 0 seconds for plink.exe, on the session manager's "Advanced" tab. Could you please raise this to the default value of 4 seconds and try again?

@dejury

This comment has been minimized.

dejury commented Dec 6, 2018

Changed the timeout to 4s. Same issue still there...

000002.log

`

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Dec 6, 2018

You probably noticed the new "Toegang geweigerd" (access denied) message in your log file? I'm wondering from which command that's caused.

@dejury

This comment has been minimized.

dejury commented Dec 10, 2018

Yeah noticed it. I'm not sure what it could be... It is really strange.

@dejury

This comment has been minimized.

dejury commented Dec 10, 2018

I think I've found what causes the problem.

I connect to SSH via a private key. That private key is stored on a network share. This might be the issue. I tested running the updates with the private key on my local desktop, then I can connect after an update.

Maybe the network share can somehow not be accessed after update?

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Dec 10, 2018

Ah that makes sense. That network share is probably not accessible with elevated (admin) privileges, which are used the first time after the update. I think I'll rename this issue so it's more clear.

@ansgarbecker ansgarbecker added enhancement and removed question labels Dec 10, 2018

@ansgarbecker ansgarbecker changed the title from SSH tunnel still active when updating to After automatic update, run heidisql.exe with normal privileges, not as admin Dec 10, 2018

@dejury

This comment has been minimized.

dejury commented Dec 10, 2018

Yeah, better. Thanks for the help until now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment