You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by da...@apache.org on 2008/06/19 15:51:23 UTC

svn commit: r669487 - in /webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src: msgprocessors/ storage/sqlite/ util/

Author: damitha
Date: Thu Jun 19 06:51:22 2008
New Revision: 669487

URL: http://svn.apache.org/viewvc?rev=669487&view=rev
Log:
Fixing memory leaks

Modified:
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c?rev=669487&r1=669486&r2=669487&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c Thu Jun 19 06:51:22 2008
@@ -1821,7 +1821,6 @@
     axis2_transport_sender_t *transport_sender = NULL;
     axis2_engine_t *engine = NULL;
     axis2_op_t *create_seq_op = NULL;
-    axis2_op_ctx_t *create_seq_op_ctx = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     axis2_bool_t continue_sending = AXIS2_TRUE;
     long retrans_interval = -1;
@@ -1833,6 +1832,7 @@
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,   
         "[Sandesha2]Entry:sandesha2_app_msg_processor_send_create_seq_msg");
+
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, internal_sequence_id, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, acks_to, AXIS2_FAILURE);
@@ -1886,6 +1886,11 @@
     create_seq_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(create_seq_rm_msg_ctx, env);
     if(!create_seq_msg_ctx)
     {
+        if(create_seq_rm_msg_ctx)
+        {
+            sandesha2_msg_ctx_free(create_seq_rm_msg_ctx, env);
+        }
+
         return AXIS2_FAILURE;
     }
 
@@ -1964,6 +1969,7 @@
     create_seq_op = axis2_msg_ctx_get_op(create_seq_msg_ctx, env);
     transport_out = axis2_msg_ctx_get_transport_out_desc(create_seq_msg_ctx, env);
     transport_sender = axis2_transport_out_desc_get_sender(transport_out, env);
+
     while(!rms_sequence_bean)
     {
         continue_sending = sandesha2_msg_retrans_adjuster_adjust_retrans(env, create_sequence_sender_bean, 
@@ -2010,10 +2016,12 @@
         sandesha2_sender_bean_free(create_sequence_sender_bean, env);
     }
 
-    create_seq_op_ctx = axis2_msg_ctx_get_op_ctx(create_seq_msg_ctx, env);
-    if(create_seq_op_ctx)
+    /* We have created this message context using sandesha2_utils_create_new_related_msg_ctx(). It is out
+     * reponsiblity to free if after use.
+     */
+    if(create_seq_msg_ctx)
     {
-        axis2_op_ctx_free(create_seq_op_ctx, env);
+        axis2_msg_ctx_free(create_seq_msg_ctx, env);
     }
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,   
@@ -2068,7 +2076,8 @@
 
     axis2_msg_ctx_set_status_code (response_msg_ctx, env, axis2_msg_ctx_get_status_code (create_seq_msg_ctx, env));
 
-    axis2_msg_ctx_set_server_side(response_msg_ctx, env, AXIS2_TRUE);
+    /* Note that we set here as client side to indicate that we are in the application client side. */
+    axis2_msg_ctx_set_server_side(response_msg_ctx, env, AXIS2_FALSE);
 
     axis2_msg_ctx_set_op_ctx(response_msg_ctx, env, axis2_msg_ctx_get_op_ctx(create_seq_msg_ctx, env));
     axis2_msg_ctx_set_conf_ctx(response_msg_ctx, env, conf_ctx);
@@ -2087,12 +2096,22 @@
         }
         else
         {
+            /* Note that this engine flow does not end with an message receiver, because
+             * when hit sandesha2_create_seq_response_msg_processor_process_in_msg()
+             * function it pause message context at the end of the function.
+             */
             status = axis2_engine_receive(engine, env, response_msg_ctx);
         }
 
         axis2_engine_free(engine, env);
     }
 
+    /* Note that as explained above this message context is not added to the operation context, 
+     * therefore will not be freed when operation context's msg_ctx_map is freed. So we need to 
+     * free the response message here.
+     */
+    axis2_msg_ctx_free(response_msg_ctx, env);
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2] Exit:sandesha2_app_msg_processor_process_create_seq_response");
 
@@ -2865,23 +2884,6 @@
 
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
 
-    /* create the response */
-    response_msg_ctx = axis2_msg_ctx_create(env, conf_ctx, axis2_msg_ctx_get_transport_in_desc(msg_ctx, 
-                env), axis2_msg_ctx_get_transport_out_desc(msg_ctx, env));
-
-    if (!response_msg_ctx)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Could not create response message context");
-        return AXIS2_FAILURE;
-    }
-
-    axis2_msg_ctx_set_server_side(response_msg_ctx, env, AXIS2_FALSE);
-    axis2_msg_ctx_set_op_ctx(response_msg_ctx, env, axis2_msg_ctx_get_op_ctx(msg_ctx, env));
-    axis2_msg_ctx_set_conf_ctx(response_msg_ctx, env, conf_ctx);
-    axis2_msg_ctx_set_svc_grp_ctx(response_msg_ctx, env, axis2_msg_ctx_get_svc_grp_ctx(msg_ctx, env));
-
-    axis2_msg_ctx_set_status_code (response_msg_ctx, env, axis2_msg_ctx_get_status_code (msg_ctx, env));
-
     response_envelope = axis2_msg_ctx_get_response_soap_envelope(msg_ctx, env);
     if(!response_envelope)
     {
@@ -2894,11 +2896,31 @@
         if(!response_envelope)
         {
             /* There is no response message context. */
+
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Response envelope not found");
             return AXIS2_SUCCESS;
         }
     }
 
+    /* create the response */
+    response_msg_ctx = axis2_msg_ctx_create(env, conf_ctx, axis2_msg_ctx_get_transport_in_desc(msg_ctx, 
+                env), axis2_msg_ctx_get_transport_out_desc(msg_ctx, env));
+
+    if (!response_msg_ctx)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Could not create response message context");
+        return AXIS2_FAILURE;
+    }
+
+    /* Note that we set here as client side to indicate that we are in the application client side.
+     * This knowledge is importatnt within app_msg_processor_process_in_msg() function.*/
+    axis2_msg_ctx_set_server_side(response_msg_ctx, env, AXIS2_FALSE);
+    axis2_msg_ctx_set_op_ctx(response_msg_ctx, env, axis2_msg_ctx_get_op_ctx(msg_ctx, env));
+    axis2_msg_ctx_set_conf_ctx(response_msg_ctx, env, conf_ctx);
+    axis2_msg_ctx_set_svc_grp_ctx(response_msg_ctx, env, axis2_msg_ctx_get_svc_grp_ctx(msg_ctx, env));
+
+    axis2_msg_ctx_set_status_code (response_msg_ctx, env, axis2_msg_ctx_get_status_code (msg_ctx, env));
+
     /* To avoid a second passing through incoming handlers at op_client */
     property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
     axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_HANDLER_ALREADY_VISITED, property);
@@ -2907,11 +2929,22 @@
     engine = axis2_engine_create(env, conf_ctx);
     if (engine)
     {
+        /* Note that this flow does not hit a message receiver because we have set the 
+         * message context to be in client side. Consequently message context will not
+         * be added to the operation context(which is normally done at msg_recv_receive()
+         * function).
+         */
         status = axis2_engine_receive(engine, env, response_msg_ctx);
 
         axis2_engine_free(engine, env);
     }
-    
+
+    /* Note that as explained above this message context is not added to the operation context, 
+     * therefore will not be freed when operation context's msg_ctx_map is freed. So we need to 
+     * free the response message here.
+     */
+    axis2_msg_ctx_free(response_msg_ctx, env);
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2] Exit:sandesha2_app_msg_processor_process_app_msg_response");
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c?rev=669487&r1=669486&r2=669487&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c Thu Jun 19 06:51:22 2008
@@ -447,7 +447,8 @@
     {
         axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_FALSE);
     }
-    
+   
+    /* Pausing the flow here so that it won't go to a message receiver which is not set for this flow */
     sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
 
     if(seq_prop_mgr)

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c?rev=669487&r1=669486&r2=669487&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c Thu Jun 19 06:51:22 2008
@@ -516,6 +516,8 @@
     sandesha2_seq_mgr_update_last_activated_time(env, internal_sequence_id, seq_prop_mgr);
     op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
+    
+    /* Pausing the flow here so that it won't go to a message receiver which is not set for this flow */
     sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
 
     if(seq_prop_mgr)

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c?rev=669487&r1=669486&r2=669487&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c Thu Jun 19 06:51:22 2008
@@ -254,8 +254,9 @@
     msg_store_bean = sandesha2_permanent_storage_mgr_get_msg_store_bean(
         storage_mgr, env, msg_ctx);
     sandesha2_msg_store_bean_set_stored_key(msg_store_bean, env, key);
-    sandesha2_permanent_bean_mgr_insert_msg_store_bean(storage_mgr_impl->bean_mgr, 
-        env, msg_store_bean);
+    sandesha2_permanent_bean_mgr_insert_msg_store_bean(storage_mgr_impl->bean_mgr, env, 
+            msg_store_bean);
+
     if(property)
     {
         axutil_hash_t *msg_ctx_map = NULL;
@@ -263,8 +264,12 @@
         axutil_hash_set(msg_ctx_map, axutil_strdup(env, key),
             AXIS2_HASH_KEY_STRING, msg_ctx);
     }
+
     if(msg_store_bean)
+    {
         sandesha2_msg_store_bean_free(msg_store_bean, env);
+    }
+
     return AXIS2_SUCCESS;
 }
 			
@@ -403,7 +408,6 @@
     axis2_transport_out_desc_t *transport_out_desc = NULL;
     axis2_endpoint_ref_t *endpoint_ref = NULL;
     axis2_op_t *op = NULL;
-    /*axis2_options_t *options = NULL;*/
     axiom_xml_reader_t *reader = NULL;
     int soap_version = -1;
     axiom_stax_builder_t *om_builder = NULL;
@@ -426,21 +430,30 @@
                 AXIS2_HASH_KEY_STRING);
         }
     }
+
     if(msg_ctx)
+    {
         return msg_ctx;
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]retrieved from database");
-    msg_store_bean = sandesha2_permanent_bean_mgr_retrieve_msg_store_bean(
-        storage_mgr_impl->bean_mgr, env, key);
+    }
+
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Message context retrieved from database");
+
+    msg_store_bean = sandesha2_permanent_bean_mgr_retrieve_msg_store_bean(storage_mgr_impl->bean_mgr, 
+            env, key);
+
     if (!msg_store_bean) 
     {
         return NULL;
     }
+
     msg_ctx = axis2_msg_ctx_create(env, conf_ctx, NULL, NULL);
     soap_env_str = sandesha2_msg_store_bean_get_soap_envelope_str(msg_store_bean, env);
-    reader = axiom_xml_reader_create_for_memory(env, soap_env_str, axutil_strlen(
-        soap_env_str), NULL, AXIS2_XML_PARSER_TYPE_BUFFER);
+    reader = axiom_xml_reader_create_for_memory(env, soap_env_str, axutil_strlen(soap_env_str), NULL, 
+            AXIS2_XML_PARSER_TYPE_BUFFER);
+
     om_builder = axiom_stax_builder_create(env, reader);
     soap_version = sandesha2_msg_store_bean_get_soap_version(msg_store_bean, env);
+
     if(SANDESHA2_SOAP_VERSION_1_1 == soap_version)
     {
         soap_builder = axiom_soap_builder_create(env, om_builder,
@@ -451,6 +464,7 @@
         soap_builder = axiom_soap_builder_create(env, om_builder,
             AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
     }
+
     soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
     if (!soap_envelope)
     {
@@ -460,42 +474,37 @@
 
     axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
 
-    axis2_msg_ctx_set_msg_id(msg_ctx, env, sandesha2_msg_store_bean_get_msg_id(
-        msg_store_bean, env));
+    axis2_msg_ctx_set_msg_id(msg_ctx, env, sandesha2_msg_store_bean_get_msg_id(msg_store_bean, env));
 
     conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     transport_out = sandesha2_msg_store_bean_get_transport_out(msg_store_bean, 
         env);
     transport_out_desc = axis2_conf_get_transport_out(conf, env, transport_out);
     axis2_msg_ctx_set_transport_out_desc(msg_ctx, env, transport_out_desc);
+
     svc_grp_name_str = sandesha2_msg_store_bean_get_svc_grp(msg_store_bean, env);
     if(svc_grp_name_str)
     {
         svc_grp = axis2_conf_get_svc_grp(conf, env, svc_grp_name_str);
         if(svc_grp)
+        {
             axis2_msg_ctx_set_svc_grp(msg_ctx, env, svc_grp);
+        }
     }
     else
     {
         svc_grp = axis2_svc_grp_create_with_conf(env, conf);
         axis2_msg_ctx_set_svc_grp(msg_ctx, env, svc_grp);
     }
+
     svc_name_str = sandesha2_msg_store_bean_get_svc(msg_store_bean, env);
     if(svc_name_str)
     {
         svc = axis2_conf_get_svc(conf, env, svc_name_str);
         if(svc)
-            axis2_msg_ctx_set_svc(msg_ctx, env, svc);
-        /*else
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot build message "\
-                 "context since service %s is not present", svc_name_str);
-            AXIS2_ERROR_SET(env->error, 
-                SANDESHA2_ERROR_CANNOT_BUILD_MSG_CTX_WHEN_SVC_NOT_PRESENT, 
-                AXIS2_FAILURE);
-            axiom_soap_builder_free(soap_builder, env);
-            return NULL;
-        */
+            axis2_msg_ctx_set_svc(msg_ctx, env, svc);
+        }
     }
 
     op_name_str = sandesha2_msg_store_bean_get_op(msg_store_bean, env);
@@ -506,16 +515,19 @@
         axis2_op_t *op = NULL;
         if(op_name_str)
         {
-            axutil_qname_t *op_qname = axutil_qname_create_from_string(env, 
-                op_name_str);
+            axutil_qname_t *op_qname = axutil_qname_create_from_string(env, op_name_str);
             op = axis2_svc_get_op_with_qname(svc, env, op_qname);
             if(op_qname)
+            {
                 axutil_qname_free(op_qname, env);
+            }
         }
+
         if(!op && op_mep_str && svc)
         {
             axutil_hash_t *all_ops = NULL;
             axutil_hash_index_t *index = NULL;
+
             /* Finding an operation using the MEP */
             all_ops = axis2_svc_get_all_ops(svc, env);
             for (index = axutil_hash_first(all_ops, env); index; index = 
@@ -524,19 +536,22 @@
                 void *v = NULL;
                 axis2_char_t *mep = NULL;
                 axis2_op_t *temp = NULL;
+
                 axutil_hash_this(index, NULL, NULL, &v);
                 temp = (axis2_op_t *) v;
-                mep = (axis2_char_t *) axis2_op_get_msg_exchange_pattern(temp, 
-                    env);
-                if(0 == axutil_strcmp(mep, op_mep_str))
+                mep = (axis2_char_t *) axis2_op_get_msg_exchange_pattern(temp, env);
+                if(!axutil_strcmp(mep, op_mep_str))
                 {
                     op = temp;
                     break;
                 }
             }
         }
+
         if(op)
+        {
             axis2_msg_ctx_set_op(msg_ctx, env, op);
+        }
         else
         {
             AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, 
@@ -547,6 +562,7 @@
             return NULL;*/
         }
     }
+
     /* Setting contexts TODO is this necessary? */
     svc_grp = axis2_msg_ctx_get_svc_grp(msg_ctx, env);
     if(svc_grp)
@@ -554,19 +570,19 @@
         axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_svc_grp_ctx_create(env, svc_grp, conf_ctx);
         axis2_msg_ctx_set_svc_grp_ctx(msg_ctx, env, svc_grp_ctx);
     }
+
     svc = axis2_msg_ctx_get_svc(msg_ctx, env);
     if(svc)
     {
-        axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_msg_ctx_get_svc_grp_ctx(
-            msg_ctx, env);
+        axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_msg_ctx_get_svc_grp_ctx(msg_ctx, env);
         axis2_svc_ctx_t *svc_ctx = axis2_svc_ctx_create(env, svc, svc_grp_ctx);
         if(svc_ctx)
         {
             axis2_svc_ctx_set_parent(svc_ctx, env, svc_grp_ctx);
             axis2_msg_ctx_set_svc_ctx(msg_ctx, env, svc_ctx);
         }
-        
     }
+
     op = axis2_msg_ctx_get_op(msg_ctx, env);
     if(op)
     {
@@ -576,70 +592,71 @@
         if(op_ctx)
         {
             axis2_char_t *msg_id = NULL;
-             axis2_op_ctx_set_parent(op_ctx, env, svc_ctx);
+
+            axis2_op_ctx_set_parent(op_ctx, env, svc_ctx);
             axis2_msg_ctx_set_op_ctx(msg_ctx, env, op_ctx);
             msg_id = (axis2_char_t *) axis2_msg_ctx_get_msg_id(msg_ctx, env);
         }
     }
+
     axis2_msg_ctx_set_server_side(msg_ctx, env, 
         sandesha2_msg_store_bean_is_svr_side(msg_store_bean, env));
+
     axis2_msg_ctx_set_flow(msg_ctx, env, 
         sandesha2_msg_store_bean_get_flow(msg_store_bean, env));
-    transport_to_str = sandesha2_msg_store_bean_get_transport_to(msg_store_bean, 
-        env);
+
+    transport_to_str = sandesha2_msg_store_bean_get_transport_to(msg_store_bean, env);
     if(transport_to_str)
     {
         axis2_msg_ctx_set_transport_url(msg_ctx, env, transport_to_str);
     }
+
     to_url_str = sandesha2_msg_store_bean_get_to_url(msg_store_bean, env);
     if(to_url_str)
     {
         endpoint_ref = axis2_endpoint_ref_create(env, to_url_str);
         axis2_msg_ctx_set_to(msg_ctx, env, endpoint_ref);
     }
+
     reply_to_str = sandesha2_msg_store_bean_get_reply_to(msg_store_bean, env);
     if(reply_to_str)
     {
         endpoint_ref = axis2_endpoint_ref_create(env, reply_to_str);
         axis2_msg_ctx_set_reply_to(msg_ctx, env, endpoint_ref);
     }
-    /*options = (axis2_options_t *) axis2_msg_ctx_get_options(msg_ctx, env);
-    if(options)
-    {
-        axis2_char_t *action = sandesha2_msg_store_bean_get_action(
-            msg_store_bean, env);
-		axis2_options_set_action(options, env, action);
-    }*/
-    {
-        axis2_char_t *action = sandesha2_msg_store_bean_get_action(
-            msg_store_bean, env);
-        axis2_msg_ctx_set_wsa_action(msg_ctx, env, action);
-    }
-    persistent_prop_str = 
-        sandesha2_msg_store_bean_get_persistent_property_str(msg_store_bean, 
-            env);
+
+    axis2_msg_ctx_set_wsa_action(msg_ctx, env, sandesha2_msg_store_bean_get_action(msg_store_bean, env));
+
+    persistent_prop_str = sandesha2_msg_store_bean_get_persistent_property_str(msg_store_bean, env);
+
     if(persistent_prop_str && 0 != axutil_strcmp("", persistent_prop_str))
     {
-        axutil_hash_t *map = 
-            sandesha2_permanent_storage_mgr_get_property_map_from_string(env, 
-                persistent_prop_str);
+        axutil_hash_t *map = NULL;
         axutil_hash_index_t *index = NULL;
+
+        map = sandesha2_permanent_storage_mgr_get_property_map_from_string(env, persistent_prop_str);
         if(map)
-            for (index = axutil_hash_first(map, env); index; index = 
-                axutil_hash_next(env, index))
+        {
+            for (index = axutil_hash_first(map, env); index; index = axutil_hash_next(env, index))
             {
                 axutil_property_t *property = NULL;
                 void *v = NULL;
                 const void *k = NULL;
                 axis2_char_t *key = NULL;
+
                 axutil_hash_this(index, &k, NULL, &v);
                 key = (axis2_char_t *) k;
                 property = (axutil_property_t *) v;
                 axis2_msg_ctx_set_property(msg_ctx, env, key, property);
             }
+        }
     }
-    /*if(msg_store_bean)
-        sandesha2_msg_store_bean_free(msg_store_bean, env);*/
+
+    if(msg_store_bean)
+    {
+        sandesha2_msg_store_bean_free(msg_store_bean, env);
+    }
+
     return msg_ctx;
 }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c?rev=669487&r1=669486&r2=669487&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c Thu Jun 19 06:51:22 2008
@@ -547,7 +547,7 @@
     }
 
     op_ctx = axis2_msg_ctx_get_op_ctx(ref_msg, env);
-    axis2_op_ctx_increment_ref(op_ctx, env);
+    /*axis2_op_ctx_increment_ref(op_ctx, env);*/
     axis2_msg_ctx_set_op_ctx(new_msg, env, op_ctx);
     axis2_msg_ctx_set_svc_ctx(new_msg, env, axis2_msg_ctx_get_svc_ctx(ref_msg, env));
     axis2_msg_ctx_set_svc_grp_ctx(new_msg, env, axis2_msg_ctx_get_svc_grp_ctx(ref_msg, env));
@@ -595,15 +595,18 @@
     if(!property)
     {
         axis2_msg_ctx_t *req_msg = NULL;
-        axis2_op_ctx_t *temp_op_ctx = axis2_msg_ctx_get_op_ctx(ref_msg, env);
+        axis2_op_ctx_t *temp_op_ctx = NULL;
+        
+        temp_op_ctx = axis2_msg_ctx_get_op_ctx(ref_msg, env);
         
         req_msg =  axis2_op_ctx_get_msg_ctx(temp_op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
         if(req_msg)
         {
-            property = axis2_msg_ctx_get_property(req_msg, env, 
-                AXIS2_WSA_VERSION);
+            property = axis2_msg_ctx_get_property(req_msg, env, AXIS2_WSA_VERSION);
             if(property)
+            {
                 addr_ver = axutil_property_get_value(property, env);
+            }
         }
     }
     else
@@ -632,8 +635,8 @@
     property = axis2_msg_ctx_get_property(ref_msg, env, AXIS2_TRANSPORT_HEADERS);
     if(property)
     {
-        axis2_msg_ctx_set_property(new_msg, env, AXIS2_TRANSPORT_HEADERS, 
-                axutil_property_clone(property, env));
+        axis2_msg_ctx_set_property(new_msg, env, AXIS2_TRANSPORT_HEADERS, axutil_property_clone(
+                    property, env));
     }
 
     paused_phase_name = (axis2_char_t*)axis2_msg_ctx_get_paused_phase_name(ref_msg, env);

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c?rev=669487&r1=669486&r2=669487&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c Thu Jun 19 06:51:22 2008
@@ -917,6 +917,16 @@
             sandesha2_msg_ctx_free(terminate_rm_msg_ctx, env);
         }
 
+        /* We have created this message context using sandesha2_utils_create_new_related_msg_ctx(). It is out
+         * reponsiblity to free if after use.
+         */
+        if(terminate_msg_ctx)
+        {
+            /* Reset the message context to avoid double freeing of transport out stream */
+            axis2_core_utils_reset_out_msg_ctx(env, terminate_msg_ctx);
+            axis2_msg_ctx_free(terminate_msg_ctx, env);
+        }
+
         return AXIS2_SUCCESS;
     }
 
@@ -1092,6 +1102,14 @@
         sandesha2_msg_ctx_free(terminate_rm_msg_ctx, env);
     }
 
+    /* We have created this message context using sandesha2_utils_create_new_related_msg_ctx(). It is out
+     * reponsiblity to free if after use.
+     */
+    if(terminate_msg_ctx)
+    {
+        axis2_msg_ctx_free(terminate_msg_ctx, env);
+    }
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
             "[sandesha2] Exit:sandesha2_terminate_mgr_send_terminate_seq_msg");
 
@@ -1167,6 +1185,8 @@
             axis2_engine_free(engine, env);
     }
 
+    axis2_msg_ctx_free(response_msg_ctx, env);
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2] Exit:sandesha2_terminate_mgr_process_terminate_msg_response");
 



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org