[asterisk-dev] Lockups in Asterisk 11

Steve Davies davies147 at gmail.com
Mon Nov 9 09:20:11 CST 2015


I also experienced a lockup using realtime postgres. I this what you are
doing? ou do not describe your environment in much detail.

If so, have you seen this patch which is in GIT for asterisk 11?

diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index be2d4ed..bce7394 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -335,7 +335,9 @@ static struct tables *find_table(const char *database,
const char *orig_tablenam
                ast_str_set(&sql, 0, "SELECT a.attname, t.typname,
a.attlen, a.attnotnull, d.adsrc, a.atttypmod FROM pg_class c, pg_type t,
pg_attribute a LEFT OUTER JOIN pg_attrdef d ON a.atthasdef AND d.adrelid =
a.attrelid AND d.adnum
        }

+       ast_mutex_lock(&pgsql_lock);
        exec_result = pgsql_exec(database, orig_tablename,
ast_str_buffer(sql), &result);
+       ast_mutex_unlock(&pgsql_lock);
        ast_debug(1, "Query of table structure complete.  Now retrieving
results.\n");
        if (exec_result != 0) {
                ast_log(LOG_ERROR, "Failed to query database columns for
table %s\n", orig_tablename);
@@ -1371,6 +1373,9 @@ static int unload_module(void)
        ast_config_engine_deregister(&pgsql_engine);
        ast_verb(1, "PostgreSQL RealTime unloaded.\n");

+       /* Unlock so something else can destroy the lock. */
+       ast_mutex_unlock(&pgsql_lock);
+
        /* Destroy cached table info */
        AST_LIST_LOCK(&psql_tables);
        while ((table = AST_LIST_REMOVE_HEAD(&psql_tables, list))) {
@@ -1378,9 +1383,6 @@ static int unload_module(void)
        }
        AST_LIST_UNLOCK(&psql_tables);

-       /* Unlock so something else can destroy the lock. */
-       ast_mutex_unlock(&pgsql_lock);
-
        return 0;
 }




On Fri, 30 Oct 2015 at 20:56 Mark Murawski <markm-lists at intellasoft.net>
wrote:

> On 10/30/15 16:04, Mark Murawski wrote:
> > I'm getting the following lockup very randomly in 11.20.  This is pretty
> > devastating to one of my production systems.
> >
> > =======================================================================
> > === 11.20.0
> > === Currently Held Locks
> > =======================================================================
>  > .... snip
>
> If this helps figure out the problem, I've added the following code to
> db.c, ast_db_put() and this appears to have alleviated the lockup
>
>         {
>                  int attempts = 10;
>
>                  while (ast_mutex_trylock(&dblock) != 0) {
>                          // didn't lock
>                          attempts--;
>                          usleep(100);
>
>                          if (attempts <= 0) {
>                                  ast_log(LOG_ERROR, "ast_db_put() COULD
> NOT LOCK.  Abandon.\n");
>                                  return -1;
>                          }
>                  }
>          }
>
> Now my logs are filling up with could not lock, but at least I'm not
> locking up entirely anymore.
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20151109/8bc46937/attachment.html>


More information about the asterisk-dev mailing list