<div dir="ltr">Hi Klaus<br><br><div class="gmail_quote">On Wed, Jul 30, 2008 at 1:12 PM, Klaus Darilion <span dir="ltr">&lt;<a href="mailto:klaus.mailinglists@pernau.at">klaus.mailinglists@pernau.at</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;"><br>
<br>
Jason Penton schrieb:<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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 <br>

</blockquote>
<br></div>
Kamailio does not use threads, but processes. Is this also an issue in multi-process applications?</blockquote><div><br>it seems it is an issued becuase under high load the mysql buffer was beign overwritten resulting in bad SQL queries. This continued until I put mutexes around the static SQLQuery buffer in the mysql module. Maybe the multi-porcess programmers can shed some light? I just thought that this may be a similar probem to what the orginal poster is experiencing.<br>
<br>Cheers <br>Jason<br>&nbsp;<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
regards<br>
klaus<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
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><div><div></div><div class="Wj3C7c">
On Tue, Jul 29, 2008 at 10:12 PM, H Quintana &lt;<a href="mailto:hjqlopez@yahoo.com" target="_blank">hjqlopez@yahoo.com</a> &lt;mailto:<a href="mailto:hjqlopez@yahoo.com" target="_blank">hjqlopez@yahoo.com</a>&gt;&gt; wrote:<br>

<br>
 &nbsp; &nbsp;Hi dear developers,<br>
<br>
<br>
 &nbsp; &nbsp;I just upgraded from 1.2.2 to 1.3.2 and I&#39;m getting a postgres error<br>
 &nbsp; &nbsp;because the DELETE query (delete from location where expires...) is<br>
 &nbsp; &nbsp;overlapped with a previous INSERT in the accounting table.<br>
<br>
 &nbsp; &nbsp;I did some changes in postgres/dbase.c to always set the end of the<br>
 &nbsp; &nbsp;string for pg_delete, pg_update, pg_query, as it is for pg_insert.<br>
 &nbsp; &nbsp; I dont know if that is the best solution but it&#39;s working for me.<br>
<br>
 &nbsp; &nbsp;Please let me know if that was ok or there is a better way to fix it.<br>
<br>
<br>
 &nbsp; &nbsp;Thanks for your time,<br>
<br>
 &nbsp; &nbsp;Humberto<br>
<br>
<br>
 &nbsp; &nbsp;*******The problem&#39;s log*******<br>
<br>
<br>
 &nbsp; &nbsp;Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
 &nbsp; &nbsp;WARNING:postgres:pg_get_result: 0x8193ef0 Probable invalid query<br>
<br>
 &nbsp; &nbsp;Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
 &nbsp; &nbsp;WARNING:postgres:pg_get_result: 0x8193ef0: PGRES_FATAL_ERROR<br>
<br>
 &nbsp; &nbsp;Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
 &nbsp; &nbsp;WARNING:postgres:pg_get_result: 0x8193ef0: ERROR: &nbsp;syntax error at<br>
 &nbsp; &nbsp;or near &quot;_from&quot; LINE 1: ...07-29 13:06:02&#39; AND expires!=&#39;1969-12-31<br>
 &nbsp; &nbsp;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; &nbsp; ^<br>
<br>
 &nbsp; &nbsp;Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
 &nbsp; &nbsp;WARNING:postgres:pg_delete: 0x8193ef0 Query: delete from location<br>
 &nbsp; &nbsp;where expires&lt;&#39;2008-07-29 13:06:02&#39; AND expires!=&#39;1969-12-31<br>
 &nbsp; &nbsp;19:00:00&#39;_from,sip_to,i_uri,o_uri,from_uri,to_uri,username,domain,hunt,invite_time,ringing_time<br>
 &nbsp; &nbsp;) values (&#39;INVITE&#39;,&#39;e5326044ad106ef2&#39;, ...<br>
<br>
<br>
 &nbsp; &nbsp;**********My solution(?) ********<br>
<br>
 &nbsp; &nbsp;[root@localhost postgres]# diff dbase.c dbase.c.orig<br>
 &nbsp; &nbsp;656d655<br>
 &nbsp; &nbsp;&lt; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
 &nbsp; &nbsp;852d850<br>
 &nbsp; &nbsp;&lt; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
 &nbsp; &nbsp;895a894<br>
 &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
 &nbsp; &nbsp;897d895<br>
 &nbsp; &nbsp;&lt; &nbsp; &nbsp; &nbsp; *(_s + off) = &#39;\0&#39;;<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
 &nbsp; &nbsp;_______________________________________________<br>
 &nbsp; &nbsp;Devel mailing list<br></div></div>
 &nbsp; &nbsp;<a href="mailto:Devel@lists.kamailio.org" target="_blank">Devel@lists.kamailio.org</a> &lt;mailto:<a href="mailto:Devel@lists.kamailio.org" target="_blank">Devel@lists.kamailio.org</a>&gt;<div class="Ih2E3d"><br>
 &nbsp; &nbsp;<a href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel" target="_blank">http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel</a><br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div class="Ih2E3d"><br>
<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.kamailio.org" target="_blank">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>
</div></blockquote>
</blockquote></div><br></div>