fix(ssh): Add SSH keep-alive to MySQL client (#32494)#41879
Conversation
|
Ready to act? Review this PR in Change Stack to turn feedback into patch suggestions you can inspect and refine. WalkthroughThis PR adds SSH keep-alive configuration to prevent stale tunnel detection and introduces three new comprehensive test suites for MySQL datasource operations. SSHUtils now configures keep-alive probes with a public interval constant. The test coverage spans executor operations, connection utilities, SSL handling, and SSH tunnel failure scenarios. ChangesSSH Keep-Alive Infrastructure and MySQL Plugin Comprehensive Test Suite
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected. |
Description
This fix implements a standard SSH keep-alive to keep the MySQL SSH client tunnel warm. An idle SSH tunnel (e.g. no queries for hours) gets silently dropped by NATs, firewalls, or the SSH server. Because sshj doesn't notice the drop,
isSSHTunnelConnected()keeps reporting the tunnel as connected, so Appsmith reuses a dead tunnel and queries fail until the tunnel is reset or recreated.Stale tunnels are still correctly detected and recreated. Enough unanswered probes cause sshj to tear the transport down,
isConnected()flips to false, and the connection is classified as stale.Fixes #
32494https://github.com/appsmithorg/appsmith/issues/32494@vivek-appsmith
JUnit Coverage improvements
│ Class │ Lines │ Branches │ Methods │
│ MySqlDatasourceUtils │ 44% → 98% (113/115) │ 51% → 76% │ 3/6 → 6/6 │
│ MySqlPlugin$MySqlPluginExecutor │ 15% → 51% (183/359) │ 9% → 35% │ 12/54 → 31/54│
Now covered (was 0%)
MySqlDatasourceUtilsTest (10 tests) — the connection-building logic:
MySqlPluginExecutorUnitTest (12 tests) — pure helpers + lifecycle:
Automation
/ok-to-test tags=""
🔍 Cypress test results
Caution
If you modify the content in this section, you are likely to disrupt the CI result for your PR.
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Tests