php - Yii2 db\Connection memory exhausted -
my code rather complex, is: read csv file, perform operations on data, select , insert data db. operations done in chunks, variables reused , none of them globals. error looks (full stack trace shown):
[bt704cdb0e1fhr6jbf5q1hg2r4][error][yii\base\errorexception:1] exception 'yii\base\errorexception' message 'allowed memory size of 134217728 bytes exhausted (tried allocate 332653 bytes)' in /usr/sites/autozapas/vendor/yiisoft/yii2/db/connection.php:782 stack trace: #0 [internal function]: yii\base\errorhandler->handlefatalerror() #1 {main} 2015-07-14 14:17:23 [2][bt704cdb0e1fhr6jbf5q1hg2r4][info][application] $_post = [ 'columns' => '{}' 'comment' => '' 'supplier_id' => '' ]
at stage application stops error. more half chunks executed. perform db operations through:
$connection = yii::$app->dbdata; $command = $connection->createcommand($sql); $command->queryall(); //or $command->execute();
the part in yii2\db\connection.php error thrown:
public function quotesql($sql) { return preg_replace_callback( '/(\\{\\{(%?[\w\-\. ]+%?)\\}\\}|\\[\\[([\w\-\. ]+)\\]\\])/', function ($matches) { if (isset($matches[3])) { return $this->quotecolumnname($matches[3]); } else { return str_replace('%', $this->tableprefix, $this->quotetablename($matches[2])); } }, $sql ); }
i not use function , of chunks have rather same sql strings. changing size of chunk doesn't help. i'm sorry, can't show code , looking suggestion kind of code can generate such error.
does had same issue?
Comments
Post a Comment