Hello, I'm getting an EntityMalformedException on cron runs if energy was emitted for a node and that node gets deleted before the energy is calculated on cron.

In _radioactivity_update_energy() I added a check to see if the entity exists

if(empty($entities)){
   return; 
}

right below the entity_load call (around line 226) and it was fixed.

thanks.

CommentFileSizeAuthor
#2 entity-exists-2293093-2.patch595 bytesbropp

Comments

loze’s picture

Issue summary: View changes
bropp’s picture

Status: Active » Needs review
StatusFileSize
new595 bytes

Ran into this issue as well. Patch attached, using loze's code.

yan’s picture

I had the same problem when I ran an upgrade from D6 to D7 (with this patch). I got the following error

Update #7003
Failed: EntityMalformedException: Missing bundle property on entity of type node in entity_extract_ids() (line 7844 in /includes/common.inc).

The following updates did not run. Patch from #2 seems to solve it.

yan’s picture

Status: Needs review » Reviewed & tested by the community

I forgot to change the status.

monymirza’s picture

Status: Reviewed & tested by the community » Needs work

I have applied patch. then drush cron but it keeps cron run and finally error.

PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 79 bytes) in /usr/share/php/drush/includes/environment.inc on line 0

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 79 bytes) in /usr/share/php/drush/includes/environment.inc on line 0
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                        [error]
Error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 79 bytes) in /usr/share/php/drush/includes/environment.inc, line 0
Segmentation fault

Am i missed anything?

monymirza’s picture

Status: Needs work » Reviewed & tested by the community
heine’s picture

Status: Reviewed & tested by the community » Needs work

monymirza, after the patch, radioactivity will attempt to process all emits that were stalled due to the entitymetadatawrapper exception. In our case, 10s of millions. This causes the site to basically load all entities (as radioactivity misses a cache reset flag somewhere) and run out of memory. Best to truncate the table radioactivity_deferred_incidents.

This is also the reason why I set this patch to "needs work".

mikedotexe’s picture

This is a pretty crucial patch, imho. I'm not sure "needs work" makes the most sense here.
The patch makes sure that future users of this module do not run into the issue. Retroactively "fixing" a site suffering from this bug is possibly better addressed case-by-case.

For instance, I'm working on a site that has 30,000 items waiting in the radioactivity_deferred_incidents table. We can have a conversation with the client about whether or not to truncate the table (to save on some CPU) or allow cron to process all of it, which is more accurate to the historical views and applied energies.

That being said, I don't think it'd be fair to have a patch that says, "truncate the necessary tables" because that isn't ideal for all situations.
On the other side, it's not ideal to always have cron process all the items, like in comment #7.

I'm not the module maintainer and haven't contributed, but I've given it some thought lately and wanted to share my perspective. I think this patch is pretty important to merge in for preventative purposes.

oldspot’s picture

Status: Needs work » Reviewed & tested by the community

I agree with mikedotexe - technically the patch fixes the issue at hand and doesn't really need any "more work".
I ran into the same issue and the patch fixes it.

Indeed after fixing the code cron took a while to finish running as it had to process everything but if the issue wasn't there in the first place then people wouldn't have to deal with massive amounts of processing after fixing the issue.

Will change to RTBC again as it should really be committed to prevent more sites having this problem.

  • Sutharsan committed 13b9efa on 7.x-2.x authored by bropp
    Issue #2293093 by bropp: EntityMalformedException on cron runs
    
sutharsan’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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