<div dir="ltr">Hi All,<br><br>one thing I noticed in the mysql module (may be similar in postrges) is that a static char array is used to build the sql query. This is however NOT thread safe as we saw on multiprocessor Solaris boxes. Basically 2 threads were overwriting and corrupting the SQL query that was eventually sent to the DB (obv. causing errors).<br>
<br>2 ways to solve this are:<br><br>1. put mutexes around the shared SQL buffer<br>2. dont use static space (obv. this is going to use more memory.<br><br>Cheers<br>Jason<br><br><div class="gmail_quote">On Tue, Jul 29, 2008 at 10:12 PM, H Quintana <span dir="ltr">&lt;<a href="mailto:hjqlopez@yahoo.com">hjqlopez@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi dear developers,<br>
<br>
<br>
I just upgraded from 1.2.2 to 1.3.2 and I&#39;m getting a postgres error because the DELETE query (delete from location where expires...) is overlapped with a previous INSERT in the accounting table.<br>
<br>
I did some changes in postgres/dbase.c to always set the end of the string for pg_delete, pg_update, pg_query, as it is for pg_insert. &nbsp;I dont know if that is the best solution but it&#39;s working for me.<br>
<br>
Please let me know if that was ok or there is a better way to fix it.<br>
<br>
<br>
Thanks for your time,<br>
<br>
Humberto<br>
<br>
<br>
*******The problem&#39;s log*******<br>
<br>
<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]: WARNING:postgres:pg_get_result: 0x8193ef0 Probable invalid query<br>
<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]: WARNING:postgres:pg_get_result: 0x8193ef0: PGRES_FATAL_ERROR<br>
<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]: WARNING:postgres:pg_get_result: 0x8193ef0: ERROR: &nbsp;syntax error at or near &quot;_from&quot; LINE 1: ...07-29 13:06:02&#39; AND expires!=&#39;1969-12-31 19:00:00&#39;_from,sip_... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^<br>

<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]: WARNING:postgres:pg_delete: 0x8193ef0 Query: delete from location where expires&lt;&#39;2008-07-29 13:06:02&#39; AND expires!=&#39;1969-12-31 19:00:00&#39;_from,sip_to,i_uri,o_uri,from_uri,to_uri,username,domain,hunt,invite_time,ringing_time ) values (&#39;INVITE&#39;,&#39;e5326044ad106ef2&#39;, ...<br>

<br>
<br>
**********My solution(?) ********<br>
<br>
[root@localhost postgres]# diff dbase.c dbase.c.orig<br>
656d655<br>
&lt; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
852d850<br>
&lt; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
895a894<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
897d895<br>
&lt; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.kamailio.org">Devel@lists.kamailio.org</a><br>
<a href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel" target="_blank">http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel</a><br>
</blockquote></div><br></div>