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

Reusing of JAX-RS Client causes memory leak

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • JAX-RS
    • None
    • Unknown

    Description

      The JAX-RS Client Javadoc states:

      Clients are heavy-weight objects that manage the client-side communication infrastructure. Initialization as well as disposal of a Client instance may be a rather expensive operation. It is therefore advised to construct only a small number of Client instances in the application. Client instances must be properly closed before being disposed to avoid leaking resources.

      However, in CXF, this is impossible. On every call to target, ClientImpl creates a fresh WebTargetImpl which then (during request) creates a WebClient instance and registers it within its parent. This baseClients collection only grows as long as the shared Client instance exists and is closed and released only when close is called on it, so that sharing causes a memory leak which cannot be prevented in any way.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mormegil Petr Kadlec
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: