Skip to content

Commit

Permalink
async(): Attempt to recover from abort() state
Browse files Browse the repository at this point in the history
It seems the "if" condition at the start of t_resume_async() is
actually reachable under the right circumstances and causes an
immediate program crash.

As an intermediate improvement until the source of the issue is found,
try to simply overwrite the unexpected context, if one is found.  A
small memory leak coupled with a CRITICAL log message is preferable to
an instant, forced crash.
  • Loading branch information
liviuchircu committed Oct 12, 2022
1 parent eea2152 commit 7167bec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/tm/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ int t_resume_async(int fd, void *param, int was_timeout)
LM_DBG("resuming without a fd, transaction %p \n", t);

if (current_processing_ctx) {
LM_CRIT("BUG - a context already set!\n");
abort();
LM_CRIT("BUG - a context is already set (%p), overwriting it...\n",
current_processing_ctx);
current_processing_ctx = NULL;
}

/* prepare for resume route, by filling in a phony UAC structure to
Expand Down

0 comments on commit 7167bec

Please sign in to comment.