<div dir="ltr">Hi Jason,<div><br></div><div>thanks for the reply.</div><div><br></div><div>the last 2 statements in presence module mod_init close the connection and set pa_db to NULL. when my module main process forks the extra processes the pa_db in presence is NULL, so when it calls pres_refresh_watchers it fails because pa_db is NULL.</div>
<div>i commented these last statements in presence mod_init and i got it to work.</div><div><br></div><div>// pa_dbf.close(pa_db);</div><div>// pa_db = NULL;</div><div><br></div><div>does this have any implications on how the module works ? is it ok to merge this change ?</div>
<div><br></div><div>Thank you</div><div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sun, 31 Aug 2014 09:40:49 +0200<br>
From: Jason Penton <<a href="mailto:jason.penton@gmail.com">jason.penton@gmail.com</a>><br>
To: "Kamailio (SER) - Development Mailing List"<br>
        <<a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>><br>
Subject: Re: [sr-dev] accessing database from a child forked process<br>
Message-ID:<br>
        <<a href="mailto:CALoGXNWvHhCAO91Tfa0w8W3eYQRvfV7Qkgte7dBnD%2BciNr_Kpg@mail.gmail.com">CALoGXNWvHhCAO91Tfa0w8W3eYQRvfV7Qkgte7dBnD+ciNr_Kpg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
To confirm exactly what processes are being used, maybe check the log file<br>
and take note of process id at each log event. For example you could check<br>
the process id of the messages showing you the connection is null. Then run<br>
kamcmd ps to show the process list with a description of each Kamailio<br>
process. That will probably point you in the correct direction.<br>
<br>
Cheers<br>
Jason<br>
<br>
<br>
On Fri, Aug 29, 2014 at 3:53 PM, Luis Azedo <<a href="mailto:luis.azedo@factorlusitano.com">luis.azedo@factorlusitano.com</a>><br>
wrote:<br>
<br>
> Hi,<br>
><br>
> i have a module that creates 1 extra process where it processes stuff in a<br>
> loop.<br>
> on some condition i fire a route_event with a fakemsg and its up to the<br>
> user of the module to take action, it tries to work like dispatcher module<br>
> or htable (mod-init) events.<br>
><br>
> the problem that i have is that, if i call some function on some module<br>
> that performs a database action, the connection is null when it calls<br>
> use_table.<br>
><br>
> in this case i'm making this call<br>
> event_route[my_module:my_event]<br>
> {<br>
>  $var(my_uri) = <<result of some operations>>;<br>
>  pres_refresh_watchers("$var(my_uri)", "dialog", 1);<br>
> }<br>
> presence module makes the call to use_table but this call fails because<br>
> the connection is null. presence module is working fine besides this.<br>
><br>
> if i make this call inside event_route[dispatcher:dst-up] it works.<br>
><br>
> i think that dispatcher fires the event inside a callback from a<br>
> registered timer, so, i think (may be wrong) that it comes from a different<br>
> process ?<br>
><br>
> i wonder if i'm missing something from child_init ? need to register<br>
> something ?<br>
><br>
> thanks for your help.<br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> sr-dev mailing list<br>
> <a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.sip-router.org/pipermail/sr-dev/attachments/20140831/9fba51e4/attachment-0001.html" target="_blank">http://lists.sip-router.org/pipermail/sr-dev/attachments/20140831/9fba51e4/attachment-0001.html</a>><br>

<br>
------------------------------<br>
<br>
_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br>
<br>
End of sr-dev Digest, Vol 70, Issue 71<br>
**************************************<br>
</blockquote></div><br></div></div></div>