<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"><<a href="mailto:klaus.mailinglists@pernau.at">klaus.mailinglists@pernau.at</a>></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> <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 <<a href="mailto:hjqlopez@yahoo.com" target="_blank">hjqlopez@yahoo.com</a> <mailto:<a href="mailto:hjqlopez@yahoo.com" target="_blank">hjqlopez@yahoo.com</a>>> wrote:<br>
<br>
Hi dear developers,<br>
<br>
<br>
I just upgraded from 1.2.2 to 1.3.2 and I'm getting a postgres error<br>
because the DELETE query (delete from location where expires...) is<br>
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<br>
string for pg_delete, pg_update, pg_query, as it is for pg_insert.<br>
I dont know if that is the best solution but it'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's log*******<br>
<br>
<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
WARNING:postgres:pg_get_result: 0x8193ef0 Probable invalid query<br>
<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
WARNING:postgres:pg_get_result: 0x8193ef0: PGRES_FATAL_ERROR<br>
<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
WARNING:postgres:pg_get_result: 0x8193ef0: ERROR: syntax error at<br>
or near "_from" LINE 1: ...07-29 13:06:02' AND expires!='1969-12-31<br>
19:00:00'_from,sip_... ^<br>
<br>
Jul 29 13:06:01 localhost /usr/local/sbin/openser[4730]:<br>
WARNING:postgres:pg_delete: 0x8193ef0 Query: delete from location<br>
where expires<'2008-07-29 13:06:02' AND expires!='1969-12-31<br>
19:00:00'_from,sip_to,i_uri,o_uri,from_uri,to_uri,username,domain,hunt,invite_time,ringing_time<br>
) values ('INVITE','e5326044ad106ef2', ...<br>
<br>
<br>
**********My solution(?) ********<br>
<br>
[root@localhost postgres]# diff dbase.c dbase.c.orig<br>
656d655<br>
< *(_s + off) = '\0';<br>
852d850<br>
< *(_s + off) = '\0';<br>
895a894<br>
> *(_s + off) = '\0';<br>
897d895<br>
< *(_s + off) = '\0';<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Devel mailing list<br></div></div>
<a href="mailto:Devel@lists.kamailio.org" target="_blank">Devel@lists.kamailio.org</a> <mailto:<a href="mailto:Devel@lists.kamailio.org" target="_blank">Devel@lists.kamailio.org</a>><div class="Ih2E3d"><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>
<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>