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/10/15 08:19:19 UTC

svn commit: r704789 - in /webservices/sandesha/trunk/c/src: handlers/sandesha2_in_handler.c handlers/sandesha2_out_handler.c msgprocessors/app_msg_processor.c util/msg_retrans_adjuster.c util/sandesha2_utils.c util/terminate_mgr.c

Author: damitha
Date: Tue Oct 14 23:19:19 2008
New Revision: 704789

URL: http://svn.apache.org/viewvc?rev=704789&view=rev
Log:
Fixing the sporadic failure when run with Apache2/C. The reason is creating the policy property bean in request
pool. Fixed by allocating it from global pool

Modified:
    webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c
    webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
    webservices/sandesha/trunk/c/src/util/terminate_mgr.c

Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c?rev=704789&r1=704788&r2=704789&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c Tue Oct 14 23:19:19 2008
@@ -17,7 +17,6 @@
 #include <axis2_engine.h>
 #include <axis2_handler_desc.h>
 #include <axutil_array_list.h>
-#include <axis2_svc.h>
 #include <axis2_msg_ctx.h>
 #include <axutil_property.h>
 #include <axis2_conf_ctx.h>
@@ -100,7 +99,6 @@
     axis2_ctx_t *ctx = NULL;
     axis2_char_t *str_done = NULL;
     axis2_char_t *reinjected_msg = NULL;
-    axis2_svc_t *svc = NULL;
     sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     sandesha2_msg_processor_t *msg_processor = NULL;
     sandesha2_seq_ack_t *seq_ack = NULL;
@@ -113,7 +111,6 @@
     axis2_bool_t dropped = AXIS2_FALSE;
     axis2_char_t *value = NULL;
     axutil_property_t *property = NULL;
-    sandesha2_property_bean_t *property_bean = NULL; 
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Start:sandesha2_in_handler_invoke");
@@ -158,23 +155,6 @@
     }
 
     conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-    svc = axis2_msg_ctx_get_svc(msg_ctx, env);
-    if(!svc)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Axis2 Service is NULL");
-
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_NULL, AXIS2_FAILURE);
-        return AXIS2_FAILURE;
-    }
-
-    property_bean = sandesha2_utils_get_property_bean(env, svc);
-    if(!property_bean)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "[sandesha2] Could not retrieve property bean from service");
-
-        return AXIS2_FAILURE;
-    }
 
     rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
@@ -415,6 +395,9 @@
                     if(drop)
                     {
                         app_msg_processor = sandesha2_app_msg_processor_create(env);
+                        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                            "[sandesha2] Applicatoin message already received. So current "\
+                            "application message dropped. Sending an ack message");
                         sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, bean_value, 
                             rmd_sequence_id, storage_mgr, sender_mgr, seq_prop_mgr, -1);
                         sandesha2_msg_processor_free(app_msg_processor, env);
@@ -556,6 +539,9 @@
                 else
                 {
                     app_msg_processor = sandesha2_app_msg_processor_create(env);
+                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                        "[sandesha2] Applicatoin message already received. So current application"\
+                        "message dropped. Sending an ack message");
                     sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, rcvd_msgs_str, 
                         rmd_sequence_id, storage_mgr, sender_mgr, seq_prop_mgr, -1);
                     

Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c?rev=704789&r1=704788&r2=704789&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c Tue Oct 14 23:19:19 2008
@@ -80,8 +80,6 @@
     sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     sandesha2_msg_processor_t *msg_processor = NULL;
     int msg_type = -1;
-    sandesha2_property_bean_t *property_bean = NULL;
-
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Entry:sandesha2_out_handler_invoke");
@@ -134,15 +132,6 @@
         axutil_qname_free(module_qname, env);
     }
 
-    property_bean = sandesha2_utils_get_property_bean(env, svc);
-    if(!property_bean)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "[sandesha2] Could not retrieve property bean from service");
-
-        return AXIS2_FAILURE;
-    }
-
     temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE);
     if(temp_prop)
     {

Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?rev=704789&r1=704788&r2=704789&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Tue Oct 14 23:19:19 2008
@@ -323,19 +323,6 @@
         return AXIS2_FAILURE;
     }
 
-    svc = axis2_msg_ctx_get_svc(app_msg_ctx, env);
-    if(!svc)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Service is NULL");
-        return AXIS2_FAILURE;
-    }
-
-    property_bean = sandesha2_utils_get_property_bean(env, svc);
-    if(!property_bean)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Property bean is NULL");
-        return AXIS2_FAILURE;
-    }
 
     property = sandesha2_msg_ctx_get_property(rm_msg_ctx, env, 
         SANDESHA2_APPLICATION_PROCESSING_DONE);
@@ -740,10 +727,21 @@
 
     sandesha2_next_msg_bean_free(next_msg_bean, env);
 
-    /*in_order_invoke = sandesha2_property_bean_is_in_order(sandesha2_utils_get_property_bean(env, 
-            axis2_conf_ctx_get_conf(conf_ctx, env)), env);*/
+    svc = axis2_msg_ctx_get_svc(app_msg_ctx, env);
+    if(!svc)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Service is NULL");
+        return AXIS2_FAILURE;
+    }
 
+    property_bean = sandesha2_utils_get_property_bean(env, svc);
+    if(!property_bean)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Property bean is NULL");
+        return AXIS2_FAILURE;
+    }
     in_order_invoke =  sandesha2_property_bean_is_in_order(property_bean, env);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "in_order_invoke:%d", in_order_invoke);
 
     /* test code */
     if(axis2_msg_ctx_get_server_side(app_msg_ctx, env))
@@ -2106,6 +2104,8 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Property bean is NULL");
         return AXIS2_FAILURE;
     }
+    
+    retrans_interval = sandesha2_property_bean_get_retrans_interval(property_bean, env); 
 
     /* If this is a one way message and if use_separate_listener property is set to true we need to 
      * start a listener manager so that create sequence response could be listened at. Note that
@@ -2281,8 +2281,6 @@
         sandesha2_msg_ctx_free(create_seq_rm_msg_ctx, env);
     }
 
-    retrans_interval = sandesha2_property_bean_get_retrans_interval(property_bean, env); 
-
     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);
@@ -2802,6 +2800,8 @@
         return AXIS2_FAILURE;
     }
 
+    retrans_interval = sandesha2_property_bean_get_retrans_interval(property_bean, env);
+
     relates_to = axis2_msg_ctx_get_relates_to(app_msg_ctx, env);
     if(relates_to)
     {
@@ -3173,7 +3173,6 @@
             axis2_msg_ctx_get_current_handler_index(app_msg_ctx, env) + 1);
 
     conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-    retrans_interval = sandesha2_property_bean_get_retrans_interval(property_bean, env);
 
     if(!is_svr_side && (!reply_to_addr || sandesha2_utils_is_anon_uri(env, reply_to_addr)))
     {

Modified: webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c?rev=704789&r1=704788&r2=704789&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c Tue Oct 14 23:19:19 2008
@@ -88,12 +88,11 @@
     internal_sequence_id = sandesha2_sender_bean_get_internal_seq_id(sender_bean, env);
    
     property_bean = sandesha2_utils_get_property_bean(env, svc);
+    max_attempts = sandesha2_property_bean_get_max_retrans_count(property_bean, env);
 
     sent_count = sandesha2_sender_bean_get_sent_count(sender_bean, env) + 1;
     sandesha2_sender_bean_set_sent_count(sender_bean, env, sent_count);
-    sandesha2_msg_retrans_adjuster_adjust_next_retrans_time(env, sender_bean, property_bean);
 
-    max_attempts = sandesha2_property_bean_get_max_retrans_count(property_bean, env);
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "max_attempts:%d", max_attempts);
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "sent_count:%d", sent_count);
     if(max_attempts > 0 &&  sent_count > max_attempts)

Modified: webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/sandesha2_utils.c?rev=704789&r1=704788&r2=704789&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Tue Oct 14 23:19:19 2008
@@ -224,8 +224,9 @@
     sandesha2_property_bean_t *property_bean = NULL; 
     
     AXIS2_PARAM_CHECK(env->error, svc, NULL);
-    
-    /*param = axis2_svc_get_param(svc, env, SANDESHA2_SANDESHA_PROPERTY_BEAN);*/
+
+    axutil_allocator_switch_to_global_pool(env->allocator);
+    param = axis2_svc_get_param(svc, env, SANDESHA2_SANDESHA_PROPERTY_BEAN);
     if(!param)
     {
         axis2_rm_assertion_t *rm_assertion = NULL;
@@ -244,12 +245,14 @@
             else
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot create Property bean");
+                axutil_allocator_switch_to_local_pool(env->allocator);
                 return NULL;
             }
         }   
         else
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot Retreive RM assertion");
+            axutil_allocator_switch_to_local_pool(env->allocator);
             return NULL;
         }
     }
@@ -258,6 +261,7 @@
         property_bean = (sandesha2_property_bean_t*) axutil_param_get_value(param, env);
     }
 
+    axutil_allocator_switch_to_local_pool(env->allocator);
     if(!property_bean)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
@@ -1598,7 +1602,7 @@
     if(!action)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "[sandesha][sandesha_util] WSA action is NULL.");
+            "[sandesha] WSA action is NULL.");
         return AXIS2_FALSE;
     }
     
@@ -1621,7 +1625,7 @@
     else
     {
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-            "[sandesha][sandesha_util] Not a RSTR message.");
+            "[sandesha] Not a RSTR message.");
         return AXIS2_FALSE;
     }
 }

Modified: webservices/sandesha/trunk/c/src/util/terminate_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/terminate_mgr.c?rev=704789&r1=704788&r2=704789&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/terminate_mgr.c Tue Oct 14 23:19:19 2008
@@ -851,6 +851,7 @@
     axis2_bool_t is_svr_side = AXIS2_FALSE;
     axis2_char_t *msg_id = NULL;
     axis2_svc_t *svc = NULL;
+    long retrans_delay = -1;
 
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
@@ -881,6 +882,10 @@
         return AXIS2_FAILURE;
     }
     
+    terminate_delay = sandesha2_property_bean_get_terminate_delay(property_bean, env); 
+    retrans_delay = sandesha2_property_bean_get_retrans_interval(property_bean, env); 
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "retrans_delay:%ld", retrans_delay);
+    
     terminate_rm_msg_ctx = sandesha2_msg_creator_create_terminate_seq_msg(env, ack_rm_msg_ctx, 
             rms_sequence_id, internal_sequence_id, seq_prop_mgr);
 
@@ -1049,7 +1054,6 @@
     terminate_sender_bean = sandesha2_sender_bean_create(env);
     sandesha2_sender_bean_set_msg_ctx_ref_key(terminate_sender_bean, env, key);
     /*sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, key, terminate_msg_ctx, AXIS2_TRUE);*/
-    terminate_delay = sandesha2_property_bean_get_terminate_delay(property_bean, env); 
     send_time = sandesha2_utils_get_current_time_in_millis(env) + terminate_delay;
     sandesha2_sender_bean_set_time_to_send(terminate_sender_bean, env, send_time);
 
@@ -1143,7 +1147,6 @@
             while(!res_envelope)
             {
                 axis2_bool_t continue_sending = AXIS2_FALSE;
-                long retrans_delay = -1;
 
                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                     "[sandesha2] Terminate Sequence response message not found. So continuing");
@@ -1160,8 +1163,6 @@
                     break;
                 }
 
-                retrans_delay = sandesha2_property_bean_get_retrans_interval(property_bean, env); 
-                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "retrans_delay:%ld", retrans_delay);
                 AXIS2_SLEEP(retrans_delay);
 
                 if(transport_sender)



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