Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-1448

file descriptor leak in axis2_http_transport_utils_get_services_static_wsdl

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.5.0, 1.6.0
    • 1.7.0
    • core/transport
    • None
    • All

    Description

      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 }

      Attachments

        Activity

          People

            Unassigned Unassigned
            mattmason Matt Mason
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: