Skip to content

ext-mysql2: connection from pool.getConnection() throws 'Invalid connection handle' on beginTransaction/execute #8746

Description

@proggeramlug

Env: perry 0.5.1512 built from main@6173ff9f6, macOS arm64, MySQL 8.0.46. MB24 Phase-0 spike.

Repro:

import mysql from "mysql2/promise";
const pool = mysql.createPool({ /* env */ });
const c = await pool.getConnection();   // resolves fine; c.release() alone works
await c.beginTransaction();             // throws

Actual: thrown value is the plain string "Invalid connection handle" (see also the separate errors-as-strings issue). Methods on the checked-out connection (beginTransaction, execute) don't see a valid underlying handle.

Expected: the mysql2 PoolConnection API — getConnection()beginTransaction()execute("SELECT … FOR UPDATE")commit()/rollback()release().

Impact: this is the canonical row-lock transaction pattern (SELECT … FOR UPDATE), i.e. the serialization backbone for anything auction/ledger-shaped; there is currently no way to run an explicit transaction from a pool under Perry. createConnection()-based transactions could not be verified either (session cut short by the param-binding race, filed separately).

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