Skip to content

Commit

Permalink
tm: don't free tm cell still linked in wait timer
Browse files Browse the repository at this point in the history
- wait timer should do the free
- friendlier handling of situation when modules binding to tm do
  inconsistent unref operations
  • Loading branch information
miconda committed Dec 29, 2015
1 parent f0b5fa7 commit d83a56b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/tm/h_table.c
Expand Up @@ -40,6 +40,7 @@
#include "t_reply.h"
#include "t_cancel.h"
#include "t_stats.h"
#include "t_funcs.h"
#include "h_table.h"
#include "../../fix_lumps.h" /* free_via_clen_lump */
#include "timer.h"
Expand Down Expand Up @@ -129,6 +130,11 @@ void free_cell_helper(tm_cell_t* dead_cell, int silent, const char *fname, unsig
if(likely(silent==0)) {
LM_WARN("removed cell %p is still linked in hash table (%s:%u)\n",
dead_cell, fname, fline);
if(t_on_wait(dead_cell)) {
LM_WARN("cell %p is still linked in wait timer (%s:%u)"
" - skip freeing now\n", dead_cell, fname, fline);
return;
}
}
unlink_timers(dead_cell);
remove_from_hash_table_unsafe(dead_cell);
Expand Down
6 changes: 6 additions & 0 deletions modules/tm/t_funcs.c
Expand Up @@ -150,6 +150,12 @@ void put_on_wait( struct cell *Trans )
}


int t_on_wait(tm_cell_t *Trans)
{
if(Trans->wait_timer.prev!=NULL || Trans->wait_timer.next!=NULL)
return 1;
return 0;
}

/* WARNING: doesn't work from failure route (deadlock, uses t_reply =>
* tries to get the reply lock again) */
Expand Down
1 change: 1 addition & 0 deletions modules/tm/t_funcs.h
Expand Up @@ -190,6 +190,7 @@ int get_ip_and_port_from_uri( str* uri , unsigned int *param_ip,


void put_on_wait( struct cell *Trans );
int t_on_wait(tm_cell_t *Trans);


int t_relay_to( struct sip_msg *p_msg ,
Expand Down

0 comments on commit d83a56b

Please sign in to comment.