cancel
Showing results for 
Search instead for 
Did you mean: 

Allowed memory size exhausted in Pdo/Abstract.php on line 128

SOLVED

Allowed memory size exhausted in Pdo/Abstract.php on line 128

After running

php bin/magento setup:upgrade

I get the following error:

PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 20480 bytes) 
in [magento2_root]/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php on line 128

Here is the try/catch block that is throwing the error:

try {
    $this->_connection = new PDO(
        $dsn,
        $this->_config['username'],
        $this->_config['password'],
        $this->_config['driver_options'] /* Line 128 */
    );

    $this->_profiler->queryEnd($q);

    // set the PDO connection to perform case-folding on array keys, or not
    $this->_connection->setAttribute(PDO::ATTR_CASE, $this->_caseFolding);

    // always use exceptions.
    $this->_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch (PDOException $e) {
    /**
    * @see Zend_Db_Adapter_Exception
    */
    #require_once 'Zend/Db/Adapter/Exception.php';
    throw new Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e);
}

 

Note: I Currently have memory_limit set to 4G in my php.ini and if I increase it to any amount I get a similar error.

 

Can anyone tell me why I am getting this error? It seems to be database related, but I am unfamiliar with how to configure "driver_options" in this scenario.

 

Thanks

-Pat

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Allowed memory size exhausted in Pdo/Abstract.php on line 128

While investigating I tried running mysql from the command line and got an error

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

So I restarted mysql by running

sudo service mysqld restart

Ran the setup:upgrade magento command again and hit a different error:

SQLSTATE[HY000]: General error: 1419 You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable), query was: CREATE TRIGGER trg_catalog_product_entity_after_insert AFTER INSERT ON catalog_product_entity FOR EACH ROW
BEGIN
INSERT IGNORE INTO `scconnector_google_feed_cl` (`entity_id`) VALUES (NEW.`entity_id`);
END

To resolve this I ran the following in the mysql command line:

mysql> SET GLOBAL log_bin_trust_function_creators = 1;

Ran the setup:upgrade magento script once more and it succeeded Smiley Happy

View solution in original post

1 REPLY 1

Re: Allowed memory size exhausted in Pdo/Abstract.php on line 128

While investigating I tried running mysql from the command line and got an error

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

So I restarted mysql by running

sudo service mysqld restart

Ran the setup:upgrade magento command again and hit a different error:

SQLSTATE[HY000]: General error: 1419 You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable), query was: CREATE TRIGGER trg_catalog_product_entity_after_insert AFTER INSERT ON catalog_product_entity FOR EACH ROW
BEGIN
INSERT IGNORE INTO `scconnector_google_feed_cl` (`entity_id`) VALUES (NEW.`entity_id`);
END

To resolve this I ran the following in the mysql command line:

mysql> SET GLOBAL log_bin_trust_function_creators = 1;

Ran the setup:upgrade magento script once more and it succeeded Smiley Happy