<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.4.2">
</HEAD>
<BODY>
Hi,<BR>
<BR>
abort_transaction() has no effect if there is no transaction in progress.&nbsp; It is deliberately called this way to make sure any unclosed transactions at this point are caught and rolled-back.<BR>
<BR>
It's a belts-and-braces thing to make sure that - even if there is a coding error in the function and the transaction is not closed when it should be - the transaction is closed before the function ends.&nbsp; Otherwise future DB operations that occur on the same DB connection could end up uncommitted within the same transaction.<BR>
<BR>
Regards,<BR>
<BR>
Peter<BR>
<BR>
On Thu, 2012-06-14 at 12:28 +0200, Daniel-Constantin Mierla wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hello,

I think I spotted the reason (checking also the logs from the issue 
reported by Charles Chance on sr-users some weeks ago, it is the same 
case) -- cc-ed Peter and Hugh because it is from a commit coming from 
them, respectively:

commit ea2fab792425bf30197d47ae08f806a908fc3681
Author: Peter Dunkley &lt;<A HREF="mailto:peter.dunkley@crocodile-rcs.com">peter.dunkley@crocodile-rcs.com</A>&gt;
Date:   Wed May 9 13:55:01 2012 +0100


There were few issues IMO added by this commit (in function int 
send_publish( publ_info_t* publ ) from modules_k/pua/send_publish.c), 
caused by letting the execution going through error: label even when all 
is ok. Before this commit, when all was ok the function returned before 
error: label.

First is the shm_free() of cb_param -- this variable is given to TM for 
returning it in callback function, where is accessed but with invalid 
content at that time -- the reason for the crash reported here.

The second is related to DB transaction operations, that's why I wanted 
to discuss it here:
- if all is ok, pua_dbf.end_transaction(pua_db) is executed
- but then goes through error: label and does 
pua_dbf.abort_transaction(pua_db)

It might be harmless, but does not look 'ok' IMO.

I pushed a commit to fix it, Hugh and Peter should check it not to break 
something that they had in mind with the commit:

<A HREF="http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1d89d7bea854c2e2c646b5d13ba215795325b50f">http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1d89d7bea854c2e2c646b5d13ba215795325b50f</A>

If feedback and testing is ok, then it will be backported.

Cheers,
Daniel

On 6/14/12 8:46 AM, Juha Heinanen wrote:
&gt; Daniel-Constantin Mierla writes:
&gt;
&gt;&gt; can you print hentity and *hentity in frame 1?
&gt; here you go:
&gt;
&gt; (gdb) frame 1
&gt; #1  0x00007ff73926b33f in publ_cback_func (t=0x7ff735d4f8f0, type=1024,
&gt;      ps=0x7fffcaef1e10) at send_publish.c:246
&gt; 246                hash_code= core_hash(hentity-&gt;pres_uri, NULL, HASH_SIZE);
&gt; (gdb) print hentity
&gt; $1 = (ua_pres_t *) 0x7ff735d1eed8
&gt; (gdb) print *hentity
&gt; $2 = {id = {s = 0x20302e322f504953 &lt;Address 0x20302e322f504953 out of bounds&gt;,
&gt;      len = 540028978}, pres_uri = 0x504953203a616956, event = 808333871,
&gt;    expires = 1346589743, desired_expires = 842608928, flag = 775436590,
&gt;    db_flag = 775106609, cb_param = 0x6e6172623b303830,
&gt;    next = 0x344768397a3d6863, ua_flag = 895568738, etag = {
&gt;      s = 0x3034363235353564 &lt;Address 0x3034363235353564 out of bounds&gt;,
&gt;      len = 808464432}, tuple_id = {
&gt;      s = 0x3030303030303030 &lt;Address 0x3030303030303030 out of bounds&gt;,
&gt;      len = 808464432}, body = 0x7669656365723b30, content_type = {
&gt;      s = 0x302e3732313d6465 &lt;Address 0x302e3732313d6465 out of bounds&gt;,
&gt;      len = 825110574}, watcher_uri = 0x686a3a706973203a, call_id = {
&gt;      s = 0x747365742e6d7640 &lt;Address 0x747365742e6d7640 out of bounds&gt;,
&gt;      len = 996763182}, to_tag = {
&gt;      s = 0x3863653436366134 &lt;Address 0x3863653436366134 out of bounds&gt;,
&gt;      len = 875914036}, from_tag = {
&gt;      s = 0x3938656630636230 &lt;Address 0x3938656630636230 out of bounds&gt;,
&gt;      len = 946222390}, cseq = 1697787949, version = 1175063864,
&gt;    outbound_proxy = 0x706973203a6d6f72, extra_headers = 0x742e6d7640686a3a,
&gt;    record_route = {
&gt;      s = 0x743b69662e747365 &lt;Address 0x743b69662e747365 out of bounds&gt;,
&gt;      len = 926771041}, remote_contact = {
&gt;      s = 0x3564303638333834 &lt;Address 0x3564303638333834 out of bounds&gt;,
&gt;      len = 962815330}, contact = {
&gt;      s = 0x6266393266373734 &lt;Address 0x6266393266373734 out of bounds&gt;,
&gt;      len = 758265909}}
&gt;
&gt; -- juha
&gt;      

</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>