I have an application that we're migrating in to Drupal 8. Its a system that allows the creation of forms for our clients and then allows the submissions by their clients.

We create base forms with default questions, they choose their base form and add their own additional questions to it. The form is live for up to 6 months. Each client may add 10+ forms over the course of a year.

When I migrated the legacy data in, which contained 970 forms plus submissions, we started running into massive problems.

The error is a fatal memory error in Statement.php. Despite PHP having 4GB. When I dug in to the problem, it is maxing out memory when the config table is queried. Each one of these webforms is in the config table.

Here's a snip of the query;

SELECT cid, data, created, expire, serialized, tags, checksum 
  FROM cache_config 
 WHERE cid IN ( :cids__0, :cids__1, :cids__2, :cids__3, 
                :cids__4, :cids__5 <snip>, :cids__969 )

As we're expecting another 200 - 300 forms to be created this year this is potentially a very large problem for us.

Here is the method;

public function execute($args = [], $options = []) {
  if (isset($options['fetch'])) {
    if (is_string($options['fetch'])) {
      // \PDO::FETCH_PROPS_LATE tells __construct() to run before properties
      // are added to the object.
      $this->setFetchMode(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, $options['fetch']);
    else {

  $logger = $this->dbh->getLogger();
  if (!empty($logger)) {
    $query_start = microtime(TRUE);
  // Error occurs here.
  $return = parent::execute($args);

  if (!empty($logger)) {
    $query_end = microtime(TRUE);
    $logger->log($this, $args, $query_end - $query_start);

  return $return;

Off the top of my head, I can see a potential solution if we could get the webforms to be treated as content and not config.

I'd love any other approach I can make also.

  • 1
    I suspect the query is being created via \Drupal\webform\WebformEntityListBuilder. You might want to see if you can tweak \Drupal\webform\WebformEntityListBuilder::getEntityIds and get around the memory limit issue. There is no easy way to switch config entities to content entities.
    – jrockowitz
    Nov 19, 2019 at 2:38
  • Thanks @jrockowitz - is it not odd that this is able to hit the memory limit though? This isn't an exceptionally large amount of data.
    – Christian
    Nov 19, 2019 at 2:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.