Revision: 5049
          http://opensips.svn.sourceforge.net/opensips/?rev=5049&view=rev
Author:   bogdan_iancu
Date:     2008-12-08 18:40:48 +0000 (Mon, 08 Dec 2008)

Log Message:
-----------
- first attempt in fixing ugly bug in concurent access to the request sip_msg 
structured cloned in SHM memory (in transaction) - callbacks are not sync'ed, 
so fo the same transaction, more than one callback can be run at a given moment 
-> write access to the shared request is not safe at all

Current TM callback status:

### acesing shm req with parsing of req 
#define TMCB_RESPONSE_OUT       (1<<7)    req = T_uas (parsed by acc)
#define TMCB_ON_FAILURE_RO      (1<<5)    req = T_uas (parsed)
#define TMCB_ON_FAILURE         (1<<6)    req = T_uas (parsed)


#### accessing shm req, but not parsing it
#define TMCB_RESPONSE_IN        (1<<1)    req = T_uas
#define TMCB_RESPONSE_FWDED     (1<<4)    req = T_uas

#### no access to shm msg
#define TMCB_REQUEST_BUILT      (1<<10)   req = p_msg
#define TMCB_REQUEST_FWDED      (1<<3)    req = p_msg
#define TMCB_E2EACK_IN          (1<<2)    req = ACK
#define TMCB_REQUEST_IN         (1<<0)    req = p_msg
#define TMCB_TRANS_DELETED      (1<<11)   req = null
#define TMCB_LOCAL_COMPLETED    (1<<8)    req = null
#define TMCB_LOCAL_RESPONSE_OUT (1<<9)    req = null


-> callbacks with no parsing access must not try to free eventual adds-on 
(because of parsing), because it may "see" parsed structs added by a concurent 
callback.

-> also a  race may occure between TMCB_RESPONSE_OUT and TMCB_ON_FAILURE 
callbacks (rw access to the same structure)


This is not a final fix but an intermediary one (at least reduces the chances 
of a crash with 99%).

Future final fix will be:
        1) do not allow extra parsing of cloned requests
        2) allow parsing of cloned requests, but make local copies before 
parsing

Modified Paths:
--------------
    trunk/modules/tm/t_hooks.c


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

_______________________________________________
Devel mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

Reply via email to