<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>29 jan 2013 kl. 11:48 skrev Peter Dunkley &lt;<a href="mailto:peter.dunkley@crocodile-rcs.com">peter.dunkley@crocodile-rcs.com</a>&gt;:</div><br class="Apple-interchange-newline"><blockquote type="cite">


  <meta http-equiv="Content-Type" content="text/html; CHARSET=UTF-8">
  <meta name="GENERATOR" content="GtkHTML/4.6.1">

<div>
Hello,<br>
<br>
The polled notification stuff in 3.3.3 has some issues.&nbsp; There are some database related race-hazards that mean you could have problems.&nbsp; These have been resolved by adding new features to the database library - but as these are new features they are only present in git master at the moment.&nbsp; The presence modules in git master have been updated to use these new features.<br>
<br>
It is also worth noting that the PostgreSQL database driver in git master is significantly more advanced, in terms of features, than the other database drivers.&nbsp; The presence notifier stuff has only been tested with PostgreSQL and may well be totally dependent on features that are only in the driver for that database (it should still run without crashing when using other databases but will probably not function correctly).&nbsp; When you do your retest please make sure that you use PostgreSQL - if you must use another database then you will need to update the Kamailio driver for that database to include support for the following new APIs:
<ul>
    <li>init2
    </li><li>start_transaction
    </li><li>end_transaction
    </li><li>abort_transaction
    </li><li>query_lock
</li></ul>
<br>
Please retry with git master and PostgreSQL and let me know if the problem persists.<br></div></blockquote>Peter - is this documented in any README?</div><div><br></div><div>Anyone that can take a look at the mySQL database driver?</div><div><br></div><div>/O<br><blockquote type="cite"><div>
<br>
Regards,<br>
<br>
Peter<br>
<br>
On Tue, 2013-01-29 at 13:32 +1300, Shane Harrison wrote:
<blockquote type="CITE">
    Hi there,
</blockquote>
<blockquote type="CITE">
    &nbsp;
</blockquote>
<blockquote type="CITE">
    I have a situation where subscriptions do not get notified and have tracked it down to a problem with the polled notify processing. Can you advise if this is a bug or correct my understanding of the code.
</blockquote>
<blockquote type="CITE">
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    I am using kamailio 3.3.3 and have 1 notify process. I have&nbsp;extended the&nbsp;support for the ua-profile event (rfc 6080). When a new subscription arrives it is added to the active_watchers table, the 'updated' column is assigned a number in the range 0 - N-1, where N is effectively the total number of polled update tasks that are called in a round-robin fashion, distributed across the notify processes. In this case updated = 7.
</blockquote>
<blockquote type="CITE">
    <br>
    In subscribe.c:
</blockquote>
<blockquote type="CITE">
    int update_subscription_notifier(struct sip_msg* msg, subs_t* subs, int to_tag_gen, int* sent_reply)
</blockquote>
<blockquote type="CITE">
    {
</blockquote>
<blockquote type="CITE">
    ...
</blockquote>
<blockquote type="CITE">
    /* Set the notifier/update fields for the subscription */
</blockquote>
<blockquote type="CITE">
    subs-&gt;updated = core_hash(&amp;subs-&gt;callid, &amp;subs-&gt;from_tag, 0) %
</blockquote>
<blockquote type="CITE">
    (pres_waitn_time * pres_notifier_poll_rate
</blockquote>
<blockquote type="CITE">
    * pres_notifier_processes);
</blockquote>
<blockquote type="CITE">
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    The notify process periodically calls pres_timer_send_notify(), which calculates the round (the update task number) and does the notify update by checking the active_watchers table for entries with updated = round. The update is done twice, first for the event then for event.winfo.
</blockquote>
<blockquote type="CITE">
    <br>
    In notify.c:
</blockquote>
<blockquote type="CITE">
    void pres_timer_send_notify(unsigned int ticks, void *param)
</blockquote>
<blockquote type="CITE">
    {
</blockquote>
<blockquote type="CITE">
    int process_num = *((int *) param);
</blockquote>
<blockquote type="CITE">
    int round = subset + (pres_waitn_time * pres_notifier_poll_rate
</blockquote>
<blockquote type="CITE">
    * process_num);
</blockquote>
<blockquote type="CITE">
    if (process_dialogs(round, 0) &lt; 0)
</blockquote>
<blockquote type="CITE">
    {
</blockquote>
<blockquote type="CITE">
    LM_ERR("Handling non presence.winfo dialogs\n");
</blockquote>
<blockquote type="CITE">
    return;
</blockquote>
<blockquote type="CITE">
    }
</blockquote>
<blockquote type="CITE">
    if (process_dialogs(round, 1) &lt; 0)
</blockquote>
<blockquote type="CITE">
    {
</blockquote>
<blockquote type="CITE">
    LM_ERR("Handling presence.winfo dialogs\n");
</blockquote>
<blockquote type="CITE">
    return;
</blockquote>
<blockquote type="CITE">
    }
</blockquote>
<blockquote type="CITE">
    }
</blockquote>
<blockquote type="CITE">
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    In this instance process_num = 0, so round = subset. However subset is incremented in process_dialogs() in notify.c:
</blockquote>
<blockquote type="CITE">
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    if (++subset &gt; (pres_waitn_time * pres_notifier_poll_rate) -1)
</blockquote>
<blockquote type="CITE">
    subset = 0;
</blockquote>
<blockquote type="CITE">
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    This means that round is incremented twice between calls to process_dialogs(round, 0), in my case round is always even, hence not detecting the subscription with updated = 7.
</blockquote>
<blockquote type="CITE">
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    It seems that the subset increment should be done in pres_timer_send_notify() rather than in process_dialogs(). Does that make sense?
</blockquote>
<blockquote type="CITE">
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    Additionally, is there a need for the second call that only handles presence.winfo subscriptions? The code could be simplified by only making one call and processing all subscriptions for the round.<br>
    <br>
    <br>
</blockquote>
<blockquote type="CITE">
    Cheers
</blockquote>
<blockquote type="CITE">
    Shane Harrison<br>
    <br>
    -- <br>
    <br>
</blockquote>
<blockquote type="CITE">
    Imagination NZ&nbsp;Ltd<br>
    Level 6 
</blockquote>
<blockquote type="CITE">
    <br>
</blockquote>
<blockquote type="CITE">
    92 Queens Drive<br>
    P0 Box 30449<br>
    Lower Hutt 5040<br>
    <br>
    +64 4 5703870 Extn 875<br>
    +64 21 608919&nbsp; (mobile)<br>
    <br>
</blockquote>
<blockquote type="CITE">
    <br>
</blockquote>
<blockquote type="CITE">
<pre>_______________________________________________
sr-dev mailing list
<a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
</blockquote>
<br>
<table cellspacing="0" cellpadding="0" width="100%">
<tbody><tr>
<td>
<pre>-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</pre>
</td>
</tr>
</tbody></table>
</div>

_______________________________________________<br>sr-dev mailing list<br><a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev<br></blockquote></div><br></body></html>