Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6591

Aegis DataSourceType.getBytes fails to close the InputStream fetched from DataSource, which prevents the underlying file to be deleted on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.7.17, 3.1.2
    • 3.1.3, 2.7.18, 3.0.7
    • Aegis Databinding
    • None
    • Microsoft Windows (7 for sure, and most likely any other version)

    • Novice
    • Patch

    Description

      At CodeObjects, Inc., we're using CXF for all SOAP-based communication between internal application servers. In one of the calls, we pass contents of a temporary file from one server to another via CXF, and then delete temporary file after the remote server call. We use javax.activation.DataSource as input parameter in this service interface and Aegis data binding with MTOM disabled to convert file contents to base64 encoded payload.

      When running on Windows 7 machines, we noticed that these temporary files are not being deleted on the client side, thus consistently filling up hard disk and running the risk of completely clogging it.

      I've reproduced the issue and traced the issue to org.apache.cxf.aegis.type.mtom.DataSourceType class, whose getBytes method calls DataSource.getInputStream method, but never closes it, which causes the behavior described above.

      I've implemented and tested a simple patch for 2.7 branch, which instead of IOUtils.copy calls IOUtils.copyAndCloseInput, and thus eliminates the described problem.

      Attachments

        1. cxf-6591.patch
          5 kB
          Sanjin Tulac

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            stulac Sanjin Tulac
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: