[OpenSER-Devel] timed out dialogs in database

Ovidiu Sas osas at voipembedded.com
Wed Mar 12 23:33:32 CET 2008


Please open a bug and post your patch into the tracker, otherwise it
will be lost here.


Regards,
Ovidiu Sas

On Wed, Mar 12, 2008 at 1:35 PM, Stanisław Pitucha
<stanis at zimbra-1.gradwell.net> wrote:
> Hi all
>  There's a problem when running openser 1.3 with realtime db (maybe cached too, but haven't checked). I'll just explain why we wanted to fix it in case it should be fixed in some other way:
>
>  @modules/dialog/dlg_db_handler.c:
>  #define GET_STR_VALUE(_res, _values, _index, _not_null, _unref)\
>  do{\
>         if (VAL_NULL((_values)+ (_index))) { \
>                 if (_not_null) {\
>                         if (_unref) unref_dlg(dlg,1);\
>                         continue; \
>                 } else { \
>                         (_res).s = 0; \
>                         (_res).len = 0; \
>                 }\
>         } else { \
>                 (_res).s = VAL_STR((_values)+ (_index)).s;\
>                 (_res).len = strlen(VAL_STR((_values)+ (_index)).s);\
>         } \
>  }while(0);
>
>  I guess that "continue" is supposed to skip processing of dialog in load_dialog_info_from_db(), but it won't really work, because continue is only getting out of do{}while() macro loop - it leaves _res uninitialized and continues processing. Fixed by removing "do" and "while" - GET_STR_VALUE isn't used in parent "if" so it's safe currently.
>
>  Then there's destroy_dlg() @modules/dialog/dlg_hash.c which doesn't handle dialog timer (if unref_dlg() was ran in previous case) - fixed by adding remove_dlg_timer(&dlg->tl);
>
>  Another thing: get_expired_dlgs() @modules/dialog/dlg_timer.c:
>  race condition in:
>  ---
>  if (d_timer->first.next==&(d_timer->first)
>  || d_timer->first.next->timeout > time )
>         return 0;
>  lock_get( d_timer->lock);
>  ... (get other dialogs)
>  ---
>  it should probably be locked before checking.
>
>  Patch attached.
> _______________________________________________
>  Devel mailing list
>  Devel at lists.openser.org
>  http://lists.openser.org/cgi-bin/mailman/listinfo/devel
>
>


More information about the Devel mailing list