Problem/Motivation

I attempted to update to 9.4.0 on a complex project. On running drush updb it crashed with this message:

 // Do you wish to run the specified pending updates?: yes.                                                             

>  [notice] Update started: image_post_update_image_loading_attribute
> Segmentation fault

In ProcessBase.php line 155:
                    
  Output is empty.  
                    

I have tracked the problem down as far as an endless loop caused by the field_group module calling EntityViewDisplay::load from within its implementation of hook_field_info_max_weight as that hook gets called each time EntityViewDisplay is initialiased.

I haven't (yet) been able to see any difference between 9.3 and 9.4 that would cause this to happen, but I think it's a core issue as the field_group code hasn't changed since April last year.

Steps to reproduce

TBC. I can't provide a succinct set of steps to reproduce yet, sorry.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

darvanen created an issue. See original summary.

darvanen’s picture

StatusFileSize
new274.2 KB

Here is a screenshot of the endless loop stack in xdebug after more than a dozen iterations:

whiz11’s picture

StatusFileSize
new14.43 KB

I am also getting a segmentation fault (core dumped) when running a drush updb after having updating the codes from 9.3.14 to 9.4.0

Could this be due to some preg_match running in a loop in the codes?

catch’s picture

Project: Drupal core » Field Group
Version: 9.4.x-dev » 8.x-3.x-dev
Component: entity system » Code
Priority: Normal » Critical

Core is loading and saving the entity view displays in an update, but it's not doing anything special otherwise.

A similar bug was reported for field_group module which was committed in 2019 #2951175: Infinite recursion on field_group_field_info_max_weight()/field_group_info_groups(). Not clear to me why the recursion check that's already there wouldn't kick in, but that seems likely to be the issue.

I'm going to move this over to Field Group, don't think we can do anything in core.

adam-delaney’s picture

I've recently encountered this issue as well. Root cause stemmed from a base field definition where the form display does not implicitly set a weight. I was not able to determine why the issue is only present when running under 9.4.0 either.

tikaszvince’s picture

StatusFileSize
new623 bytes

Hi,

I fought this all day long. I found that if we use drupal_static instead of local static variable declaration this recursion is eliminated.

I've attached a patch to bypass this error.

tikaszvince’s picture

Status: Active » Needs review
jrearick’s picture

The patch seems to be working for us. It works in both 9.3.16 and 9.4.0, so I'm willing to RTBC this

jrearick’s picture

Status: Needs review » Reviewed & tested by the community
darvanen’s picture

Title: EntityViewDisplay::load in hook_field_info_max_weight can cause endless loop » Recursion tracker doesn't work

Thanks for checking it out and triaging appropriately @catch

@tkaszvince nice find! The change makes sense to me and I would call your patch a fix rather than a way to bypass.

+1 RTBC

adam-delaney’s picture

This patch worked for me as well running Drupal 9.4.0 as well as 9.3.16.

+1 for RTBC, it would be great to get this addressed in a release.

ruuds’s picture

+1 for RTBC. This fixes the Segmentation fault for me too.

jeremyskinner’s picture

I also ran into the same issue upgrading several sites from Drupal 8.9 to Drupal 9.4. Patch from #6 solved this for me too.

jfcolomer’s picture

Thanks @tikaszvince, #6 works for me as well.

pbonnefoi’s picture

Same here. I had the issue and #6 fixed it (with Drupal 9.4.1). Well done @tikaszvince

tomtech’s picture

+1 for RTBC.

sagesolutions’s picture

+1 RTBC

Works on Drupal 9.4.1

znerol’s picture

#6 is the correct way to fix this issue. RTBC +1.

nils.destoop’s picture

Status: Reviewed & tested by the community » Fixed

Thx for the patch, it has been committed to dev

jrearick’s picture

Awesome! Thanks nils.destoop. Any word on a release soon?

tobiberlin’s picture

Today I run into the same issue with our quite complex project which I wanted to upgrade to Drupal 9.4. The patch resolved it - thank you so much @tikaszvince

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

karimb’s picture

I can confirm patch #6 has been committed into stable release 8.x-3.4 and it seems working with D9.4.8 ;)