You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Matt Mason (JIRA)" <ji...@apache.org> on 2010/02/05 17:53:28 UTC

[jira] Created: (AXIS2C-1448) file descriptor leak in axis2_http_transport_utils_get_services_static_wsdl

file descriptor leak in axis2_http_transport_utils_get_services_static_wsdl
---------------------------------------------------------------------------

                 Key: AXIS2C-1448
                 URL: https://issues.apache.org/jira/browse/AXIS2C-1448
             Project: Axis2-C
          Issue Type: Bug
          Components: core/transport
    Affects Versions: 1.6.0, 1.5.0
         Environment: All
            Reporter: Matt Mason


This problem affects at least 1.5.0 and 1.6.0.  I haven't checked any earlier versions.
When viewing the wsdl via services/ServiceName?wsdl
the wsdl is opened with a call to fopen and the result assigned to a local FILE* variable.  However there is no corresponding call to fclose.
We have a monitoring script that periodically requests the wsdl to check that the service is available.
The process (currently) has a limit of 1024 open file handles, eventually this leak causes that number to be exceeded.
The client library we use to connect to the service also requests the wsdl file when connecting to the service.

With reference to the code in the 1.6.0 release, here is the 1 liner to plug the leak.

Regards,

Matt

core/transport/http/util/http_transport_utils.c

1882        wsdl_file = fopen(wsdl_path, "r");
1883         if (wsdl_file)
1884         {
1885             c = fgetc(wsdl_file);
1886             while (c != EOF)
1887             {
1888                 if (i >= size)
1889                 {
1890                     size = size * 3;
1891                     tmp = (axis2_char_t *) AXIS2_MALLOC(env->allocator, size);
1892                     memcpy(tmp, content, i);
1893                     AXIS2_FREE(env->allocator, content);
1894                     content = tmp;
1895                 }
1896                 content[i++] = (axis2_char_t)c;
1897                 c = fgetc(wsdl_file);
1898             }
1899             content[i] = AXIS2_ESC_NULL;
1900             wsdl_string = (axis2_char_t *)content;
1901             fclose(wsdl_file);                                                      <---- Added this line
1902         }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.