--- realname.module.orig	2011-02-21 16:18:42.000000000 -0600
+++ realname.module	2011-05-28 22:50:03.186785892 -0500
@@ -426,9 +426,19 @@
  * Implements hook_user().
  */
 function realname_user($op, &$edit, &$account, $category = NULL) {
+    // kjh: if users have a profile field that is a node reference and
+    // A refers to B and B to A, this causes an infinite loop
+    $realnames = &drupal_static('realnames', array());
+    
   switch ($op) {
     case 'load':
-      $account->realname = realname_make_name($account);
+        if (isset($realnames[$account->uid])) {
+            $account->realname = $realnames[$account->uid];
+        } else {
+            $realnames[$account->uid] = 'pending';
+            $account->realname = realname_make_name($account);
+            $realnames[$account->uid] = $account->realname;
+        }
 
       // If theme then replace name with realname.
       if (variable_get('realname_theme', TRUE) && $account->realname) {
