Index: path_redirect.module
===================================================================
--- path_redirect.module	(revision 5540)
+++ path_redirect.module	(working copy)
@@ -331,7 +331,43 @@
   drupal_goto('admin/build/path-redirect');
 }
 
+/**
+ * Implementing hook_cron()
+ *
+ */
+function path_redirect_cron() { 
+  //perform periodic cleanup of paths that have potential to cause infinite redirection loop
+  //it is possible that with path_redirect_save changes, this could go into a hook_update_n 
+  //because new looping records would not be written so a clean up should not have to be done more than once
+  $query = "SELECT rid FROM url_alias u INNER JOIN path_redirect p ON u.src = p.redirect AND  p.path = u.dst";
+  $result = db_query($query);
+  while ( $row = db_fetch_object($result)) {
+    path_redirect_delete(null, null, $row->rid);
+  }
+}
+
+
 function path_redirect_save($edit) {
+  /**
+   * Start: Infinite redirection loop prevention
+   */
+  //here we try to prevent writing records that redirect from path alias back to the raw url such as dst to src 
+  //because globalredirect module redirects from src back to dst and that causes infinite loop
+  //since globalredirect does not have database tables through which this problem could be fixed, we try to fix it in here
+  $looping = FALSE; //whether this path redirect will cause infinite loop
+  $query = "SELECT * FROM {url_alias} u WHERE src = '%s' AND dst = '%s'";
+  $result = db_query($query, $edit['redirect'], $edit['path']);
+  while ($infiloop = db_fetch_object($result)) {
+    $looping = TRUE;
+    continue ;  //found what we were looking for. lets exit
+  }
+  if ($looping) {
+    return ;    //prevent writing record that potentialy could cause an infinite redirecting loop
+  }
+  /**
+   * Finish: Infinite redirection loop prevention
+   */
+  
   if (empty($edit['rid'])) {
     $edit['rid'] = db_next_id('{path_redirect}_rid');
   }
