Skip to content
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

BUG: Connection error with SSH tunnel after Self-Update to 5.2.8 (Linux) #781

Closed
nicnab opened this issue May 17, 2024 · 27 comments
Closed
Labels
bug Something isn't working

Comments

@nicnab
Copy link

nicnab commented May 17, 2024

I installed DBgate 5.2.7 yesterday for the first time and love the program very much! I added three MariaDB connections, all with SSH tunnel, for testing and all worked fine.

This morning I wanted to continue testing when DBgate updated itself to version 5.2.8. Now, none of the three connections will work anymore. SSH connection to db host on terminal works fine and also connection to MariaDB on host works as expected.

Here's the detailed error message from DBgate:

Error: connect ECONNREFUSED 127.0.0.1:10000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)

Error JSON: {
  "errno": -111,
  "code": "ECONNREFUSED",
  "syscall": "connect",
  "address": "127.0.0.1",
  "port": 10000,
  "fatal": true
}

Connection: {
  "server": "***",
  "engine": "mariadb@dbgate-plugin-mysql",
  "sshMode": "agent",
  "sshKeyfile": "***",
  "user": "***",
  "password": "***",
  "displayName": "***",
  "useSshTunnel": true,
  "sshHost": "***",
  "sshLogin": "***",
  "_id": "***",
  "unsaved": false
}

Platform: linux

Version Information (please complete the following information):

  • OS: Manjaro KDE, Kernel 6.6.30
  • App Version 5.2.8
  • Database engine: MariaDB 10.3.39
@janproch
Copy link
Member

Which installation are you using? I am trying SNAP and flatpak distributions under ubuntu and SSH tunnel with MariaDB works normally

@pgp
Copy link

pgp commented May 17, 2024

similar problem here... I am not able to see tables in my postgres local connection, after last (silent) update from 5.2.7 to 5.2.8.
I use the linux x64 AppImage version

immagine

@nicnab
Copy link
Author

nicnab commented May 17, 2024

Which installation are you using? I am trying SNAP and flatpak distributions under ubuntu and SSH tunnel with MariaDB works normally

AppImagine here!

Btw I tried removing the .dbgate folder and start fresh but it didn't help either.

@pgp
Copy link

pgp commented May 17, 2024

workaround (for Linux only - and maybe for other unix systems):

  • re-download v5.2.7 AppImage from releases page
  • set the file as executable (chmod +x <appimage-filename>) and immutable (sudo chattr +i <appimage-filename>)
  • the 5.2.8 update will be downloaded anyway (only once, will be kept in cache folder), but its installation on app close will fail, so the old 5.2.7 file will remain untouched

@nicnab
Copy link
Author

nicnab commented May 17, 2024

Excellent tipp, @pgp ! Thank you. It works.

@janproch
Copy link
Member

Thanks for workaround @pgp

Another workaround mentioned in #782

It seems this problem is related to manjaro, on ubuntu, I have not problems with appimages

Please let me know, it this problem occurs on non-manjaro distributions

Fixing this will probably take more time, currectly I don't have manjaro installed

@nicnab
Copy link
Author

nicnab commented May 17, 2024

It seems this problem is related to manjaro, on ubuntu, I have not problems with appimages
[...]
Fixing this will probably take more time, currectly I don't have manjaro installed

Yes Manjaro here. The bug seems to be 5.2.8 specific though. It's even there when I re-download 5.2.8 and gone when I use 5.2.7.

@janproch
Copy link
Member

There is lot of dependencies upgraded between 5.2.7 and 5.2.8 (eg. electron was upgraded from v17 to v30)

@nicnab
Copy link
Author

nicnab commented May 17, 2024

Let me know if I can help you in any way.

@nicnab
Copy link
Author

nicnab commented May 17, 2024

Small update, maybe it helps: same problem with EndeavourOS, so it might be an Arch thing? I paste the terminal output of starting 5.2.8 and trying to open MariaDB on host "nextcloud" via ssh tunnel in case you can do something with that:

$ ./dbgate-latest.AppImage 
17:17:14.299 › Checking for update
{"pid":302419,"caller":"directories","level":30,"msg":"Cleaning directory /home/xxx/.dbgate/logs","time":1715959034768}
{"pid":302419,"caller":"useController","name":"main","level":30,"msg":"Calling init controller for controller /connections","time":1715959034845}
{"pid":302419,"caller":"useController","name":"main","level":30,"msg":"Calling init controller for controller /database-connections","time":1715959034846}
{"pid":302419,"caller":"useController","name":"main","level":30,"msg":"Calling init controller for controller /scheduler","time":1715959034847}
17:17:16.706 › Update for version 5.2.8 is not available (latest version: 5.2.8, downgrade is disallowed).
17:17:16.706 › checkForUpdatesAndNotify called, downloadPromise is null
{"pid":302512,"caller":"requirePlugin","name":"serverConnection","level":30,"msg":"Loading module dbgate-plugin-mysql from /tmp/.mount_dbgateDJdj9m/resources/app.asar/packages/plugins/dbgate-plugin-mysql/dist/backend.js","time":1715959038194}
(node:302419) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `dbgate --trace-deprecation ...` to show where the warning was created)
{"pid":302419,"caller":"sshTunnel","level":30,"msg":"Creating SSH tunnel to nextcloud-localhost:3306, using local port 10000","time":1715959038798}
{"pid":302419,"caller":"sshTunnel","level":30,"msg":"Created SSH tunnel to nextcloud-localhost:3306, using local port 10000","time":1715959039377}
{"pid":302419,"level":50,"msg":"node:internal/process/promises:289","time":1715959039394}
{"pid":302419,"level":50,"msg":"            triggerUncaughtException(err, true /* fromPromise */);","time":1715959039394}
{"pid":302419,"level":50,"msg":"            ^","time":1715959039395}
{"pid":302419,"level":50,"msg":"Error: connect ECONNREFUSED 127.0.0.1:10000","time":1715959039395}
{"pid":302419,"level":50,"msg":"    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {","time":1715959039395}
{"pid":302419,"level":50,"msg":"  errno: -111,","time":1715959039395}
{"pid":302419,"level":50,"msg":"  code: 'ECONNREFUSED',","time":1715959039395}
{"pid":302419,"level":50,"msg":"  syscall: 'connect',","time":1715959039395}
{"pid":302419,"level":50,"msg":"  address: '127.0.0.1',","time":1715959039395}
{"pid":302419,"level":50,"msg":"  port: 10000,","time":1715959039395}
{"pid":302419,"level":50,"msg":"  fatal: true","time":1715959039395}
{"pid":302419,"level":50,"msg":"}","time":1715959039395}
{"pid":302419,"level":50,"msg":"Node.js v20.11.1","time":1715959039396}

@gordonlau
Copy link

I am using Ubuntu 24.04 and this problem also appears.

Screenshot from 2024-05-17 17-10-30

This error is kind of a generic error for node.js. I am not sure if it is because the node.js version is incompatible.

@janproch
Copy link
Member

janproch commented May 18, 2024

@nicnab Could you please try newest BETA https://github.com/dbgate/dbgate/releases/tag/v5.2.9-beta.2 from with fix from @ProjectInfinity ?

On Mac, this fix solved similar SSH connection issue, probably it would be the same problem

@pgp
Copy link

pgp commented May 18, 2024

just tried 5.2.9 beta 2 linux x64 AppImage, the problem on my side presists... It is worth noting that I use a local postgres connection (localhost:5432) and the db is running on a custom socket (i.e. using pgctl to start with a custom db data directory, under /dev/shm).
The connection is ok, but only postgres functions are shown in the side explorer (not tables).
However, standard queries (e.g. SELECT) work fine.

@nicnab
Copy link
Author

nicnab commented May 18, 2024

@nicnab Could you please try newest BETA https://github.com/dbgate/dbgate/releases/tag/v5.2.9-beta.2 from with fix from @ProjectInfinity ?

Sorry I will be back at the work machine in two weeks :-/ Will gladly pick up then though!

@datgausaigon
Copy link

Hi, I am use macOS and got the this issue too.
I create Connection with enable SSH Tunnel.

@KeshariPiyush24
Copy link

Same issue with MacOS, did anyone come up with some solution?

@janproch
Copy link
Member

@datgausaigon @KeshariPiyush24 did you try the BETA version https://github.com/dbgate/dbgate/releases/tag/v5.2.9-beta.2 ? It solved this issue on Mac for me

@pgp issue you mentioned is related to #793 , BETA version should solve only SSH tunnel issue

@janproch janproch changed the title BUG: No connections possible after Self-Update to 5.2.8 (Linux) BUG: Connection error with SSH tunnel after Self-Update to 5.2.8 (Linux) May 20, 2024
@datgausaigon
Copy link

@janproch Yup, the BETA version fix this issue. ❤️

@datgausaigon @KeshariPiyush24 did you try the BETA version https://github.com/dbgate/dbgate/releases/tag/v5.2.9-beta.2 ? It solved this issue on Mac for me

@pgp issue you mentioned is related to #793 , BETA version should solve only SSH tunnel issue

@nicnab
Copy link
Author

nicnab commented May 20, 2024

@nicnab Could you please try newest BETA https://github.com/dbgate/dbgate/releases/tag/v5.2.9-beta.2 from with fix from @ProjectInfinity ?

On Mac, this fix solved similar SSH connection issue, probably it would be the same problem

Ok it's raining and the kids are playing so I found some time to install dbgate on my laptop (also Manjaro with Plasma 6.0.4) and test beta 2. Unfortunately I didn't work. Both ssh and dbs work via terminal (and VPN this time). Here's the terminal output:

$ ./dbgate.AppImage 
14:05:25.914 › Checking for update
libva error: /usr/lib/dri/i965_drv_video.so init failed
{"pid":17142,"caller":"directories","level":30,"msg":"Cleaning directory /home/nico/.dbgate/logs","time":1716206726567}
{"pid":17142,"caller":"useController","name":"main","level":30,"msg":"Calling init controller for controller /connections","time":1716206726688}
{"pid":17142,"caller":"useController","name":"main","level":30,"msg":"Calling init controller for controller /database-connections","time":1716206726689}
{"pid":17142,"caller":"useController","name":"main","level":30,"msg":"Calling init controller for controller /scheduler","time":1716206726690}
14:05:28.831 › Error: HttpError: 404 
"method: GET url: https://github.com/dbgate/dbgate/releases/download/v5.2.9-beta.2/latest-linux.yml\n\nPlease double check that your authentication token is correct. Due to security reasons, actual status maybe not reported, but 404.\n"
Headers: {
  "cache-control": "no-cache",
  "content-encoding": "gzip",
  "content-length": "29",
  "content-security-policy": "default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'",
  "content-type": "text/plain; charset=utf-8",
  "date": "Mon, 20 May 2024 12:05:28 GMT",
  "referrer-policy": "no-referrer-when-downgrade",
  "server": "GitHub.com",
  "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
  "vary": "X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With",
  "x-content-type-options": "nosniff",
  "x-frame-options": "deny",
  "x-github-request-id": "AAA2:E35EB:AC059C8:AEEC5EE:664B3C87",
  "x-xss-protection": "0"
}
    at createHttpError (/tmp/.mount_dbgatevdD3fb/resources/app.asar/node_modules/electron-updater/node_modules/builder-util-runtime/out/httpExecutor.js:14:12)
    at ElectronHttpExecutor.handleResponse (/tmp/.mount_dbgatevdD3fb/resources/app.asar/node_modules/electron-updater/node_modules/builder-util-runtime/out/httpExecutor.js:116:20)
    at ClientRequest.<anonymous> (/tmp/.mount_dbgatevdD3fb/resources/app.asar/node_modules/electron-updater/node_modules/builder-util-runtime/out/httpExecutor.js:82:26)
    at ClientRequest.emit (node:events:518:28)
    at SimpleURLLoaderWrapper.<anonymous> (node:electron/js2c/browser_init:2:114121)
    at SimpleURLLoaderWrapper.emit (node:events:518:28)
(node:17142) UnhandledPromiseRejectionWarning: HttpError: 404 
"method: GET url: https://github.com/dbgate/dbgate/releases/download/v5.2.9-beta.2/latest-linux.yml\n\nPlease double check that your authentication token is correct. Due to security reasons, actual status maybe not reported, but 404.\n"
Headers: {
  "cache-control": "no-cache",
  "content-encoding": "gzip",
  "content-length": "29",
  "content-security-policy": "default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'",
  "content-type": "text/plain; charset=utf-8",
  "date": "Mon, 20 May 2024 12:05:28 GMT",
  "referrer-policy": "no-referrer-when-downgrade",
  "server": "GitHub.com",
  "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
  "vary": "X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With",
  "x-content-type-options": "nosniff",
  "x-frame-options": "deny",
  "x-github-request-id": "AAA2:E35EB:AC059C8:AEEC5EE:664B3C87",
  "x-xss-protection": "0"
}
    at createHttpError (/tmp/.mount_dbgatevdD3fb/resources/app.asar/node_modules/electron-updater/node_modules/builder-util-runtime/out/httpExecutor.js:14:12)
    at ElectronHttpExecutor.handleResponse (/tmp/.mount_dbgatevdD3fb/resources/app.asar/node_modules/electron-updater/node_modules/builder-util-runtime/out/httpExecutor.js:116:20)
    at ClientRequest.<anonymous> (/tmp/.mount_dbgatevdD3fb/resources/app.asar/node_modules/electron-updater/node_modules/builder-util-runtime/out/httpExecutor.js:82:26)
    at ClientRequest.emit (node:events:518:28)
    at SimpleURLLoaderWrapper.<anonymous> (node:electron/js2c/browser_init:2:114121)
    at SimpleURLLoaderWrapper.emit (node:events:518:28)
(Use `dbgate --trace-warnings ...` to show where the warning was created)
(node:17142) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
{"pid":17245,"caller":"requirePlugin","name":"serverConnection","level":30,"msg":"Loading module dbgate-plugin-mysql from /tmp/.mount_dbgatevdD3fb/resources/app.asar/packages/plugins/dbgate-plugin-mysql/dist/backend.js","time":1716206730993}
(node:17142) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
{"pid":17142,"caller":"sshTunnel","level":30,"msg":"Creating SSH tunnel to phylax-localhost:3306, using local port 10000","time":1716206731699}
{"pid":17253,"caller":"sshProcess","name":"sshForward","err":{"level":"agent"},"level":50,"msg":"Error creating SSH tunnel connection:","time":1716206733651}

@ProjectInfinity
Copy link
Collaborator

Could you maybe share how you are setting up the tunnel?

From the logs it looks like you're trying to tunnel port 3306 from phylax-localhost. Is that correct? Perhaps using the ip or domain may work.

@bbrdaric
Copy link

v5.2.9-beta.2 solved issue for me on MacOS also!

@nicnab
Copy link
Author

nicnab commented May 23, 2024

Could you maybe share how you are setting up the tunnel?

From the logs it looks like you're trying to tunnel port 3306 from phylax-localhost. Is that correct? Perhaps using the ip or domain may work.

That is correct. I have a dnsmasq running that resolves phylax. It works on the command line but not in dbgate. But I did just test using only the IP and also with "127.0.0.1" instead of "localhost" but the problem is still the same.

@PhillipMwaniki
Copy link

@nicnab Could you please try newest BETA https://github.com/dbgate/dbgate/releases/tag/v5.2.9-beta.2 from with fix from @ProjectInfinity ?

On Mac, this fix solved similar SSH connection issue, probably it would be the same problem

THis worked for me on MacOS Monterey

@cruzmanny
Copy link

I believe I am having the same issue. Whenever I try to connect to a remote MariaDB database I am met with an error connection refused. I noticed that the port is not the one I specified. I am using the homebrew version for mac. I downgraded to 5.2.7 and it works fine with the same configuration.

Error: connect ECONNREFUSED *******:10000 <----- not the port i specified
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)

Error JSON: {
"errno": -61,
"code": "ECONNREFUSED",
"syscall": "connect",
"address": "******",
"port": 10000, <----not the port I specified
"fatal": true
}

Connection: {
"server": "",
"engine": "mariadb@dbgate-plugin-mysql",
"sshMode": "keyFile",
"sshKeyfile": "
",
"user": "",
"password": "
",
"displayName": "",
"_id": "
",
"unsaved": false,
"port": "this port is correct",
"useSshTunnel": true,
"sshHost": "",
"sshPort": "
",
"sshLogin": "",
"sshKeyfilePassword": "
"
}

Platform: darwin

@ProjectInfinity
Copy link
Collaborator

I believe I am having the same issue. Whenever I try to connect to a remote MariaDB database I am met with an error connection refused. I noticed that the port is not the one I specified. I am using the homebrew version for mac. I downgraded to 5.2.7 and it works fine with the same configuration.

Error: connect ECONNREFUSED *******:10000 <----- not the port i specified at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)

Error JSON: { "errno": -61, "code": "ECONNREFUSED", "syscall": "connect", "address": "******", "port": 10000, <----not the port I specified "fatal": true }

Connection: { "server": "", "engine": "mariadb@dbgate-plugin-mysql", "sshMode": "keyFile", "sshKeyfile": "", "user": "", "password": "", "displayName": "", "_id": "", "unsaved": false, "port": "this port is correct", "useSshTunnel": true, "sshHost": "", "sshPort": "", "sshLogin": "", "sshKeyfilePassword": "" }

Platform: darwin

You need to run 5.2.9-beta.2 or newer in order to benefit from the SSH fixes. You will not find them in the homebrew version.

@janproch janproch added the bug Something isn't working label May 27, 2024
@nicnab
Copy link
Author

nicnab commented Jun 4, 2024

Ok back in the saddle. I just tested 5.2.9 and the latest beta and all works well! Not sure what the issue via VPN was but I will report if I find anything else.

Thanks a lot for fixing this so quickly and, again, for providing such a nice piece of software as FOSS!

@nicnab nicnab closed this as completed Jun 4, 2024
@nicnab
Copy link
Author

nicnab commented Jun 4, 2024

Fixed in 5.2.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants