PDO:There is no active transaction

error

The

sentry background sees the error There is no active transaction , which occurs in a update method, roughly

function update() {
    $this->db->beginTrans();
    try {
        dosomething();
        $this->db->commitTrans();
    } catch (\Exception $ex) {
        this->db->rollBackTrans();
        throw $ex;
    }
}
I also checked the

dosomething () method carefully. There is no place to open the transaction and end the transaction, and the error position is on the line $this- > db- > commitTrans (); . It"s a bit strange why there are no transactions?

db class

I guess it"s the db class (no transaction is opened). This class is changed by me with workman mysql helper (adding a master-slave read). The source code is here , and I open the transaction part is

.
public function beginTrans()
{
    $this->Trans = true;
    try {
        return $this->pdo->beginTransaction();
    } catch (PDOException $e) {
        // 
        if ($e->errorInfo[1] == 2006 || $e->errorInfo[1] == 2013) {
            $this->closeConnection();
            $this->pdoRW = $this->getConnectionInstance($this->configs["rw"]);
            $this->pdo = $this->pdoRW;
            return $this->pdo->beginTransaction();
        } else {
            throw $e;
        }
    }
}

however, transactions are also started, and it is strange that the cause of the problem occurs (this problem sometimes occurs)

Jan.10,2022

may not be a session.. In fact, there is no need to do it all over again. To find the reason for the failure of the connection. Instead of retrying the connection..

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31e1f-4ea33.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31e1f-4ea33.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?