]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
deal with handles being released incorrectly
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 31 Oct 2012 15:31:23 +0000 (10:31 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 31 Oct 2012 15:31:23 +0000 (10:31 -0500)
src/switch_core_sqldb.c

index ba3f116d3c1c039f2f5e9d77955153f160675999..ac32d7d146f3806ef55b225c690541ea95ac50d3 100644 (file)
@@ -209,6 +209,7 @@ static void sql_close(time_t prune)
 {
        switch_cache_db_handle_t *dbh = NULL;
        int locked = 0;
+       int sanity = 10000;
 
        switch_mutex_lock(sql_manager.dbh_mutex);
  top:
@@ -254,7 +255,12 @@ static void sql_close(time_t prune)
 
                } else {
                        if (!prune) {
-                               locked++;
+                               if (!sanity) {
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SANITY CHECK FAILED!  Handle %s (%s;%s) was not properly released.\n", 
+                                                                         dbh->name, dbh->creator, dbh->last_user);
+                               } else {
+                                       locked++;
+                               }
                        }
                        continue;
                }
@@ -262,6 +268,10 @@ static void sql_close(time_t prune)
        }
 
        if (locked) {
+               if (!prune) {
+                       switch_cond_next();
+                       if (sanity) sanity--;
+               }
                goto top;
        }