You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/11/23 06:53:13 UTC

svn commit: r478476 - in /webservices/axis2/trunk/c: modules/core/transport/http/receiver/http_svr_thread.c util/include/axis2_thread_pool.h util/src/thread_pool.c

Author: samisa
Date: Wed Nov 22 21:53:12 2006
New Revision: 478476

URL: http://svn.apache.org/viewvc?view=rev&rev=478476
Log:
Fixing thead pool related leaks on server side

Modified:
    webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c
    webservices/axis2/trunk/c/util/include/axis2_thread_pool.h
    webservices/axis2/trunk/c/util/src/thread_pool.c

Modified: webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c?view=diff&rev=478476&r1=478475&r2=478476
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_svr_thread.c Wed Nov 22 21:53:12 2006
@@ -48,6 +48,7 @@
     axis2_env_t *env;
     axis2_socket_t socket;
     axis2_http_worker_t *worker;
+    axis2_thread_t *thread;
 }
 axis2_http_svr_thd_args_t;
 
@@ -218,9 +219,11 @@
         arg_list->env = (axis2_env_t *)env;
         arg_list->socket = socket;
         arg_list->worker = svr_thread_impl->worker;
+        arg_list->thread = NULL;
 #ifdef AXIS2_SVR_MULTI_THREADED
         worker_thread = AXIS2_THREAD_POOL_GET_THREAD(env->thread_pool,
                 worker_func, (void *)arg_list);
+        arg_list->thread = worker_thread;
         if (NULL == worker_thread)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Thread creation failed"
@@ -337,7 +340,6 @@
     AXIS2_SIMPLE_HTTP_SVR_CONN_FREE(svr_conn, thread_env);
     if (request)
         AXIS2_HTTP_SIMPLE_REQUEST_FREE(request, thread_env);
-    AXIS2_FREE(thread_env->allocator, arg_list);
     AXIS2_PLATFORM_GET_TIME_IN_MILLIS(&t2);
     millisecs = t2.millitm - t1.millitm;
     secs = difftime(t2.time, t1.time);
@@ -370,7 +372,14 @@
     /*axis2_env_free_masked(thread_env, 0x2);*/
     /*axiom_xml_reader_cleanup();*/
 #ifdef AXIS2_SVR_MULTI_THREADED
-    /*AXIS2_THREAD_POOL_EXIT_THREAD(env->thread_pool, thd);*/
+    AXIS2_THREAD_POOL_EXIT_THREAD(thread_env->thread_pool, arg_list->thread);
 #endif
+    AXIS2_FREE(thread_env->allocator, arg_list);
+
+    if (thread_env)
+    {
+        axis2_free_thread_env(thread_env);
+        thread_env = NULL;
+    }
     return NULL;
 }

Modified: webservices/axis2/trunk/c/util/include/axis2_thread_pool.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axis2_thread_pool.h?view=diff&rev=478476&r1=478475&r2=478476
==============================================================================
--- webservices/axis2/trunk/c/util/include/axis2_thread_pool.h (original)
+++ webservices/axis2/trunk/c/util/include/axis2_thread_pool.h Wed Nov 22 21:53:12 2006
@@ -113,6 +113,13 @@
 AXIS2_EXTERN struct axis2_env * AXIS2_CALL
 axis2_init_thread_env(const struct axis2_env *system_env);
 
+/**
+ * This function can be used to free the environment that was used  
+ * in a thread function
+ */
+AXIS2_EXTERN void AXIS2_CALL
+axis2_free_thread_env(struct axis2_env *thread_env);
+
 #define AXIS2_THREAD_POOL_GET_THREAD(thread_pool, func, data) \
       ((thread_pool)->ops->get_thread(thread_pool, func, data))
 

Modified: webservices/axis2/trunk/c/util/src/thread_pool.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/thread_pool.c?view=diff&rev=478476&r1=478475&r2=478476
==============================================================================
--- webservices/axis2/trunk/c/util/src/thread_pool.c (original)
+++ webservices/axis2/trunk/c/util/src/thread_pool.c Wed Nov 22 21:53:12 2006
@@ -164,4 +164,11 @@
             system_env->log, system_env->thread_pool);
 }
 
-
+AXIS2_EXTERN void AXIS2_CALL
+axis2_free_thread_env(struct axis2_env *thread_env)
+{
+    thread_env->allocator = NULL;
+    thread_env->log = NULL;
+    thread_env->thread_pool = NULL;
+    axis2_env_free(thread_env);
+}



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