Skip to content

[p2]Session move assignment transfers the ID but not the connection or owning pool #148

Open

Description

@chenshi5012

Please check the FAQ documentation before raising an issue

Describe the bug (required)
The current Session::operator=(Session&&) transfers only the session ID and some string/time-zone state. It does not release the destination's existing session, and it does not move the connection, the owning-pool pointer, the reconnect setting, or the broken-connection state. This can combine the source session ID with the destination's old connection and pool. The source connection is not returned to its original pool, and the destination's destructor may return the old connection to the wrong pool.

Your Environments (required)

  • OS: ubuntu
  • Commit id : master lastest

Reproduction steps

  1. Initialize two different ConnectionPool instances and obtain one valid Session from each.
  2. Execute destination = std::move(source).
  3. Check whether the destination has the source session ID; after both sessions leave scope, check the number of idle connections in each pool.
nebula::ConnectionPool poolA, poolB;
// Initialize both pools and obtain sessionA and sessionB from them.
const auto sourceId = sessionB.sessionId_;  // Inspect internal state in a test.
sessionA = std::move(sessionB);
// Current behavior: sessionA gets sourceId but still refers to poolA;
// sessionB is marked invalid.

Expected behavior

Safely release the destination's old session, then transfer the source session's ID, connection, pool ownership, and related state as a unit. The source should become a safe moved-from object that no longer owns a session or connection. When the scope ends, each pool should recover its own connection.

Actual behavior

The targeted reproduction observed that the destination still referred to its original pool, while the source became invalid and its original pool had zero idle connections. The source connection was not returned to its original pool.

Additional context

Activity

  1. changed the title [-]Session move assignment transfers the ID but not the connection or owning pool[/-] [+][p2]Session move assignment transfers the ID but not the connection or owning pool[/+] on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions