Skip to content

Commit

Permalink
dialog: Fix missing unlock ops on DB load error-cases
Browse files Browse the repository at this point in the history
This patch fixes some startup deadlocks in case a dialog loaded from
database has an incorrect DID (failed checksum check) or if OpenSIPS
runs out of shared memory while importing dialogs from DB on startup.

(cherry picked from commit 9e8d36c)
  • Loading branch information
liviuchircu committed Sep 14, 2021
1 parent a903c18 commit 229bf72
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/dialog/dlg_db_handler.c
Expand Up @@ -627,6 +627,7 @@ static int load_dialog_info_from_db(int dlg_hash_size)
}

if(dlg->h_entry != hash_entry){
dlg_unlock(d_table, d_entry);
LM_ERR("inconsistent hash data in the dialog database: "
"you may have restarted opensips using a different "
"hash_size: please erase %.*s database and restart\n"
Expand Down Expand Up @@ -670,6 +671,7 @@ static int load_dialog_info_from_db(int dlg_hash_size)
LM_ERR("dlg_set_leg_info failed\n");
/* destroy the dialog */
unref_dlg_unsafe(dlg, 1, d_entry);
dlg_unlock(d_table, d_entry);
continue;
}
dlg->legs_no[DLG_LEG_200OK] = DLG_FIRST_CALLEE_LEG;
Expand Down Expand Up @@ -727,6 +729,7 @@ static int load_dialog_info_from_db(int dlg_hash_size)
ZSW(dlg->legs[callee_idx(dlg)].tag.s));
/* destroy the dialog */
unref_dlg_unsafe(dlg, 1, d_entry);
dlg_unlock(d_table, d_entry);
continue;
}

Expand Down

0 comments on commit 229bf72

Please sign in to comment.