Skip to content

fix(mysql): forceClose during connect leaks the SSH tunnel handle, and the interrupted session is revived #1313

Closed

Description

@ZhuchkaTriplesix

Problem

MysqlConnection.forceClose (lib/core/database/mysql_connection.dart:404) returns early with if (c == null) return;, before the SSH handle is released. When it runs while connect() is in flight (tunnel opened, _conn not yet assigned), the handle is never released and the tunnel session keeps a reference forever.

Also, _connectOnce sets _isConnected = true when it completes, so a connection that was interrupted in that window comes back as connected. PostgresConnection.forceClose releases the handle regardless.

Scope

  • Release the tunnel handle before the early return, as PostgreSQL does.
  • Mark the in-flight attempt as cancelled so it closes what it opened instead of reviving it.
  • Test: forceClose while a (fake) connect is pending.

Acceptance

  • The tunnel's ref-count is back to zero after forceClose during connect.
  • The interrupted connection is not connected afterwards.

Activity

  1. added
    bugSomething isn't working
    stabilityTheme parser epic label: stability
    mysqlMySQL database driver and workspace
    connectionsDatabase connections, URI parsing, pools
    P3Low priority / Polish & Enhancements
    on Oct 10, 2026
  2. added a commit that references this issue on Oct 10, 2026
  3. ZhuchkaTriplesix commented on Oct 10, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Сделано в #1326, смержено в dev.

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

Metadata

Metadata

Labels

P3Low priority / Polish & EnhancementsbugSomething isn't workingconnectionsDatabase connections, URI parsing, poolsmysqlMySQL database driver and workspacestabilityTheme parser epic label: stability

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions