Memory leak in axis2_http_worker_process_request (http_worker.c) ----------------------------------------------------------------
Key: AXIS2C-1586 URL: https://issues.apache.org/jira/browse/AXIS2C-1586 Project: Axis2-C Issue Type: Bug Components: core/transport Affects Versions: 1.6.0 Environment: Solaris 10 Reporter: Serghei Samsi If trying to connect to HTTP based service (axis2_http_serv) by using telnet and simply exiting, appears memory leak which grows after each connect. How to reproduce: Try # telnet <AXIS_IP> <AXIS_PORT> ^C Solaris MBD output: umem_alloc_2304 leak: 1 buffer, 2304 bytes ADDR BUFADDR TIMESTAMP THREAD CACHE LASTLOG CONTENTS 810f380 8111c00 34aa8a030e830 2 80b3590 0 0 libumem.so.1`umem_cache_alloc_debug+0x16c libumem.so.1`umem_cache_alloc+0x15c libumem.so.1`umem_alloc+0x3f libumem.so.1`malloc+0x23 libaxutil.so.0.6.0`axutil_allocator_malloc_impl+0x1b libaxutil.so.0.6.0`axutil_stream_create_basic+0x57 libaxis2_http_common.so.0.6.0`axis2_http_worker_process_request +0x20 libaxis2_http_receiver.so.0.6.0`axis2_svr_thread_worker_func+0x 8c libaxutil.so.0.6.0`dummy_worker+0x10 libc.so.1`_thr_setup+0x4e libc.so.1`_lwp_start umem_alloc_56 leak: 1 buffer, 56 bytes ADDR BUFADDR TIMESTAMP THREAD CACHE LASTLOG CONTENTS 817a630 81799e8 34aa8a030d2fd 2 80a3010 0 0 libumem.so.1`umem_cache_alloc_debug+0x16c libumem.so.1`umem_cache_alloc+0x15c libumem.so.1`umem_alloc+0x3f libumem.so.1`malloc+0x23 libaxutil.so.0.6.0`axutil_allocator_malloc_impl+0x1b libaxutil.so.0.6.0`axutil_stream_create_internal+0x1e libaxutil.so.0.6.0`axutil_stream_create_basic+0x1e libaxis2_http_common.so.0.6.0`axis2_http_worker_process_request +0x20 libaxis2_http_receiver.so.0.6.0`axis2_svr_thread_worker_func+0x 8c libaxutil.so.0.6.0`dummy_worker+0x10 libc.so.1`_thr_setup+0x4e libc.so.1`_lwp_start The problems is in leaked out_stream: <code> AXIS2_EXTERN axis2_bool_t AXIS2_CALL axis2_http_worker_process_request( ... axutil_stream_t *out_stream = axutil_stream_create_basic(env); ... axis2_msg_ctx_set_transport_out_stream(msg_ctx, env, out_stream); ... return ...; <code> Comments on axis2_msg_ctx_set_transport_out_stream says that - citated "Here out_stream is set into the in message context". But is msg_cts is null, out_stream will never be freed. The basic idea is that stream should be created ONLY if msg_ctx does exist. So the trivial patch which fixes mentioned problem: *** axis2c-src-1.6.0-orig/src/core/transport/http/common/http_worker.c Mon Apr 6 07:46:47 2009 --- axis2c-src-1.6.0/src/core/transport/http/common/http_worker.c Fri Feb 3 14:07:33 2012 *************** *** 115,121 **** axutil_stream_t *request_body = NULL; /* Creating out_stream as basic stream */ ! axutil_stream_t *out_stream = axutil_stream_create_basic(env); axis2_http_simple_response_t *response = NULL; /* Transport in and out descriptions */ --- 115,121 ---- axutil_stream_t *request_body = NULL; /* Creating out_stream as basic stream */ ! axutil_stream_t *out_stream = NULL; axis2_http_simple_response_t *response = NULL; /* Transport in and out descriptions */ *************** *** 474,480 **** * To avoid double freeing of out_stream we reset the out message context at the end of engine * receive function. */ ! axis2_msg_ctx_set_transport_out_stream(msg_ctx, env, out_stream); headers = axis2_http_worker_get_headers(http_worker, env, simple_request); axis2_msg_ctx_set_transport_headers(msg_ctx, env, headers); --- 474,484 ---- * To avoid double freeing of out_stream we reset the out message context at the end of engine * receive function. */ ! if (msg_ctx) ! { ! out_stream = axutil_stream_create_basic(env); ! axis2_msg_ctx_set_transport_out_stream(msg_ctx, env, out_stream); ! } headers = axis2_http_worker_get_headers(http_worker, env, simple_request); axis2_msg_ctx_set_transport_headers(msg_ctx, env, headers); -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: c-dev-unsubscr...@axis.apache.org For additional commands, e-mail: c-dev-h...@axis.apache.org