We have a "bio" field added to our user profiles, and the text format used for it has the mentions filter enabled. Now when a user mentions herself in that field, Drupal will crash with a "memory exceeded" error whenever the user object is loaded. (I call such a user "self-mentioning" below.) This includes at least the following situations:

  • visiting a node that contains a string that can be interpreted as a mention of the self-mentioning user
  • visiting a node authored by the self-mentioning user
  • running the "rebuild permissions" admin task, in case there are nodes matching any of the two cases above
  • visiting the user profile at http://example.com/users/username
  • trying to delete the user in the admin interface

  • trying to delete the user with drush user-cancel username

So it looks like an infinite recursion (... it even happens with memory_limit = 1024M :D).

Workaround: For now, use a text format in user profile fields that does not have the mentions filter enabled (see /admin/config/content/formats in the admin interface). If you have such an error already, look up the user ID and field name and fix it directly in the datase (after doing a backup) like this:

UPDATE field_data_field_yourfieldname SET field_yourfieldname_value = '' WHERE entity_type = 'user' AND entity_id = 'your-uid-here';

Comments

tanius’s picture

Issue summary: View changes

Added two more cases that trigger the issue.

cattmote’s picture

I encountered this issue as well and have implemented the workaround for the time being.

I'm not sure how to approach fixing this because in order to detect the potential recursive loop you need a reference to the user entity which the text belongs to, but that doesn't seem to be available in the filter hooks.

aron novak’s picture

Here's a fully robust, but not very sophisticated workaround. It does not make any harm in any normal situation, but it prevents the module to eat all RAM and CPU cycles (forever... here it's the place of the jokes about infinite recursion)

aron novak’s picture

Status: Active » Needs review
ivnish’s picture

Status: Needs review » Reviewed & tested by the community

  • ivnish committed 0accb70 on 7.x-1.x authored by Aron Novak
    Issue #2228469 by Aron Novak, tanius, ivnish: Self-mention in user...
ivnish’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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