WSOD when adding entity load events with user entity type

Created on 9 January 2023, almost 2 years ago
Updated 20 April 2023, over 1 year ago

Problem/Motivation

While working on a workflow I got a white screen of death site wide, and had to manually restore the database. I narrowed it down to the point where I added Two(2) Start Events. Maybe if I was doing something dumb it could prevent me from saving it with two start events if that was the problem?

1. Update content entity User:User
2. Load content entity User:User

Steps to reproduce

See attached video WSOD-Two_actions2023-01-09_12-38-23.mp4
1. Create new Model.
2. Add Circle with Update content entity User:User
3. Add second Circle with Load content entity User:User
4. Hit save
5. See error, no drush commands help trying to clear cache resulted in `/mnt/ddev_config/.global_commands/web/drush: line 14: 2520 Segmentation fault drush "$@"`. Site had to be recovered by manually deleting the config entries from the database.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.2

Component

Code

Created by

🇺🇸United States NicholasS

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Just got something similar to this issue. At first, I thought it's because of 2 Events but then, when I narrowed down to only one event which is PreLoad Content Entity With this event, I immediately got 503 error :

    Service Unavailable
    
    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

    Also, try drush cr and got "Segmentation fault"

    Also try with -any- , Content: Article and many more to make it more specific but always got 503 Error if I put this event in the model.

    Below is the error I got from Server log :

    [Tue Apr 18 18:05:46.970961 2023] [proxy_fcgi:error] [pid 17691:tid 140248491009792] (104)Connection reset by peer: [client x.x.x.x:0] AH01075: Error dispatching request to :

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I can't reproduce this. Is this happening when you just add that event or is there also any action happening afterwards in the ECA model?

  • 🇩🇪Germany mxh Offenburg

    We've encountered the same problem using the "Load content entity" event. It was used by accident, but when saving the model it broke the whole site. The only exist problem was using the kill switch as documented here: https://ecaguide.org/eca/troubleshooting/

    I think that event is extremely dangerous, maybe we should consider removing it? Or we need a solid mechanic for that event that it doesn't lead to that problem.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Hmm, are we talking about PreLoad Content Entity or Load Content Entity?

    I have a model that contains both, and I don't see any crash. Therefore, my question, is there any action following the event or is it just the presence of the event.

  • @jurgenhaas, I just added "PreLoad Content Entity", and save it, once I saved, my site went down immediately. Need kill switch to get back online.

    Also, just tested "Load Content Entity", site went down too but with different error :

    [Tue Apr 18 19:06:41.571995 2023] [proxy_fcgi:error] [pid 17693:tid 140248440653568] [client x.x.x.x:0] AH01071: Got error 'PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /xxx/domains/xx.xxx.com/public_html/core/lib/Drupal/Core/Cache/DatabaseBackend.php on line 167'

  • 🇩🇪Germany mxh Offenburg

    I don't remember exactly, but I think it was just the presence of the event that led to the error. I think it was then the error as @abx posted in #10.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I'm having a hard time reproducing this. Can we make this somehow reproducible?

  • 🇩🇪Germany mxh Offenburg

    At least I get an error (a different one) on a fresh Drupal installation having some ECA modules installed: Created one start event with "Load content entity" for entity type User, and having one successor action "Display a message to the user".

    The error I get then is:

    Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "eca.service.condition", path: "eca.service.condition". in Drupal\Component\DependencyInjection\Container->get() (line 147 of core/lib/Drupal/Component/DependencyInjection/Container.php).
    

    Think the problem most likely occurs when using the load event on user entities.

  • I think I just found what cause this problem. (In my case) It's about Log Level. I can set to anything except "Debug". If I set Log Level to "Debug", then, error will appear.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Confirmed, the log level set to debug is causing this. I'll have a look.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
  • @jurgenhaas opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    The debug log ended up in a recursion, i.e. there is a chance that getting data from the token system, an entity needs to get loaded, and that triggers another "Entity: load" event, which again triggers a debug log.

    This MR adds a simple recursion prevention mechanism and it seems to be working here,

  • Just tested patch #16 and I don't get any error with Log Level "Debug" anymore.

    Thanks jurgenhaas,

  • 🇩🇪Germany jurgenhaas Gottmadingen

    If we got this one to RTBC, it may be time for another release for ECA 1.1.x

  • I think I found another problem after patched. If I put Preload Content Entity / Load Content Entityinto the model, it's still working, but once I point it to an action. (Here is Display A Message to The User) The only text to display is "Test". Then, the error below appear :

    [Wed Apr 19 17:53:52.516161 2023] [proxy_fcgi:error] [pid 10665:tid 140248222541568] [client xxx.xxx.xxx.xxx:0] AH01071: Got error 'PHP message: Uncaught PHP Exception Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException: "Circular reference detected for service "eca.service.condition", path: "eca.service.condition"." at /xxx/xx.xxx.com/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php line 147', referer: https://xx.xxx.com/

  • Status changed to Needs work over 1 year ago
  • 🇩🇪Germany mxh Offenburg

    Yes, the problem is that the eca.service.condition service is being loaded for evaluating the event to apply, and it is loading a user entity within its constructor:

    $this->currentUser = $entity_type_manager->getStorage('user')->load($account_proxy->id());

    Thus we'll get a recursion on service instantiation on that circumstance.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    This currentUser is only used for conditions, that have an entity:user context definition data type. AFAIK tell, that's not used anywhere, and we should be able to remove this from the conditions services. What do you think?

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
  • @mxh opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany mxh Offenburg

    Yes, it looks like a leftover from back when we used core condition plugins. Created MR348 that removes the current user as suggested in #22. Then the error from #20 should be gone, at least that's the case on my environment ATM.

  • Status changed to RTBC over 1 year ago
  • Just tested by applied both patches (#16, #23) , no more error. Everything seems to work great now.

    Thanks mxh, jurgenhaas

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks @mxh for cleaning this up. I tend to keep the service declaration as is for the 1.1.x branch, just to not break stuff if the cache didn't get rebuild immediately. But for 1.2, we take the full cleanup. Hope that's OK?

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
    • jurgenhaas committed 6a1a9d31 on 1.2.x
      Issue #3332070 by jurgenhaas, mxh, NicholasS, abx: WSOD when adding...
  • 🇩🇪Germany mxh Offenburg

    Yes it's fine, then the constructor arguments also need to remain the same.

    • jurgenhaas committed 7f47dd7b on 1.1.x
      Issue #3332070 by jurgenhaas, mxh, NicholasS, abx: WSOD when adding...
  • Status changed to Fixed over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024