Memory error when updating user field with Rules
Your problem is loop update user infinity. When user update, hook_entity_update will be call:
/**
 * Implements hook_entity_update().
 */
function rules_entity_update(EntityInterface $entity) {
  // Only handle content entities and ignore config entities.
  if ($entity instanceof ContentEntityInterface) {
    $entity_type_id = $entity-&gt;getEntityTypeId();
    $event = new EntityEvent($entity, [
      $entity_type_id =&gt; $entity,
      $entity_type_id . '_unchanged' =&gt; $entity-&gt;original,
    ]);
    $event_dispatcher = \Drupal::service('event_dispatcher');
    $event_dispatcher-&gt;dispatch(&quot;rules_entity_update:$entity_type_id&quot;, $event);
  }
}

soure
This event will be call your rule action. So when you call $user-&gt;save(), the hook_entity_update will call again... That's your problem. To be resolve, you can follow example.

Edit your annotation. &quot;user&quot; = @ContextDefinition(&quot;entity:user&quot;,
Update logic method doExecute
Update your rule.

Remember don't call $user-&gt;save() again.