Skip to content

Comments

Dispose SSH connection when disconnecting & fixed disconnection events handling#3071

Open
sebjulliand wants to merge 8 commits intomasterfrom
cleanDisconnect
Open

Dispose SSH connection when disconnecting & fixed disconnection events handling#3071
sebjulliand wants to merge 8 commits intomasterfrom
cleanDisconnect

Conversation

@sebjulliand
Copy link
Member

Changes

Fixes #2578

This PR fixes:

  • The SSH connection not being disposed after the user manually disconnects
  • The handling of disconnection events:
    • When end happens, then a normal disconnection happened (i.e. the user manually disconnected)
    • When error happens it means the connection was dropped on the client or server side

The connection not being disposed was causing #2578.
A broken connection will now only show the reconnect dialog once, for the connection that actually dropped.

How to test this PR

  1. Reproduce the steps from Opening connections then dropping vpn causes multiple pop ups #2578 (comment)
  2. Shut down VPN, or Wifi, or pull you Ethernet cable
  3. Wait for a timeout for happen
  4. The reconnect dialog shoud show up just once, for the connection that just dropped

Checklist

  • have tested my change

@sebjulliand sebjulliand requested a review from a team February 12, 2026 22:14
@sebjulliand sebjulliand self-assigned this Feb 12, 2026
@sebjulliand sebjulliand added the bug A confirmed issue when something isn't working as intended label Feb 12, 2026
@sebjulliand sebjulliand temporarily deployed to testing_environment February 12, 2026 22:14 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

👋 A new build is available for this PR based on 09fc3bf.

@arco400
Copy link

arco400 commented Feb 13, 2026

@sebjulliand I have tested the vsix and it solved my issue. I also tested the steps described in #2578, and the connection popup only appeared once so also good.

Sidenote: While running on the vsix version, I got the message "Code for IBM i will not function correctly until the temporary library has been corrected in the settings." I looked at the settings but did not see any anomalies. The temp library setting is filled with ILEDITOR.

@sebjulliand
Copy link
Member Author

Sidenote: While running on the vsix version, I got the message "Code for IBM i will not function correctly until the temporary library has been corrected in the settings." I looked at the settings but did not see any anomalies. The temp library setting is filled with ILEDITOR.

@arco400 thank you for your test and your feedback; much appreciated!
I alos had this message during my testing but thought it was a one of a kind issue. I'll try to dig it a bit.

Copy link
Member

@SanjulaGanepola SanjulaGanepola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebjulliand Glad you found the main issue with this. I was also running into this problem often!

I did notice one regression which we should address as I confirmed that it doesn't happen on the master branch.

While running on the vsix version, I got the message "Code for IBM i will not function correctly until the temporary library has been corrected in the settings."

As for this specific error, I wasn't running into this on my end so not sure what may have caused it for you both.

@sebjulliand
Copy link
Member Author

@SanjulaGanepola It should be just fine now 🤞🏻

@SanjulaGanepola SanjulaGanepola changed the title DIspose SSH connection when disconnecting & fixed disconnection events handling Dispose SSH connection when disconnecting & fixed disconnection events handling Feb 14, 2026
@SanjulaGanepola
Copy link
Member

@sebjulliand After some more testing, I believe the issue I found is actually not due to the changes in this PR, but actually from the big Mapepire PR.

The steps to reproduce:

  1. Set a breakpoint in IBMi.runSQL
  2. Connect to your VPN
  3. Connect to IBM i
  4. Once it hits the breakpoint, disconnect from VPN
  5. Continue your debug and notice the UI is just hung

The idea is to have the SQL job connected, then disconnect your VPN, and try to execute some SQL. Looks like when await query.execute is called it doesn't return or even throw an error. I gave this a try in mapepire-js, but it does throw an error there. So could the issue be in our extended class?

export class sshSqlJob extends SQLJob {

Side note: Can we pull in @types/ssh2 as a dev dependency?

@sebjulliand
Copy link
Member Author

sebjulliand commented Feb 14, 2026

Side note: Can we pull in @types/ssh2 as a dev dependency?

I'm definitely adding it; it's been bugging me so far not having these types 😛

Signed-off-by: Seb Julliand <[email protected]>
@github-actions
Copy link
Contributor

👋 A new build is available for this PR based on 5303aac.

Signed-off-by: Seb Julliand <[email protected]>
@sebjulliand sebjulliand temporarily deployed to testing_environment February 14, 2026 21:46 — with GitHub Actions Inactive
@sebjulliand sebjulliand temporarily deployed to testing_environment February 14, 2026 22:45 — with GitHub Actions Inactive
@sebjulliand sebjulliand temporarily deployed to testing_environment February 15, 2026 10:56 — with GitHub Actions Inactive
@sebjulliand sebjulliand temporarily deployed to testing_environment February 16, 2026 22:36 — with GitHub Actions Inactive
@sebjulliand sebjulliand deployed to testing_environment February 16, 2026 22:46 — with GitHub Actions Active
@sebjulliand
Copy link
Member Author

@SanjulaGanepola I think I fixed it all.
I reworked the disconnection workflow, so every resource that needs to be reset/disposed is so whenever the connection is closed, for any reason.

Dropping the VPN at any point in time should not be a problem anymore.

I also found what the issue was with Code for IBM i will not function correctly until the temporary library has been corrected in the settings.: the global counter used to record the position in the SQL job joblog was not reset after disconnecting. That came from the Mapepire jumbo PR 😅

To reproduce the bug, you simply need to connect, disconnect, connect again to the same system.
I fixed it by resetting that counter whenever we disconnect.

Hopefully it's all good now 🙏🏻

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

Labels

bug A confirmed issue when something isn't working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening connections then dropping vpn causes multiple pop ups

3 participants