Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-5802

Connection leaks in UPSERT SELECT/DELETE paths due to MutatingParallelIteratorFactory iterator not being closed

    XMLWordPrintableJSON

Details

    Description

      During an UPSERT SELECT query or client-side DELETE, we clone the existing Phoenix connection and call mutate which eventually calls either upsertSelect or deleteRows.

      When getting iterators, if we encounter any exception, then on calling close, we attempt to cancel any queued work, while accumulating already-started task futures.
      Later we attempt to block on getting the result (iterator) of already-started tasks and close each iterator.

      Here however, if any of the upsert-select or client-side delete tasks had thrown an exception E, we wouldn't be able to close the underlying iterator (which in-turn would'veĀ closed the cloned connection). This manifests as these logs:

      "Failed to execute task during cancel", <exception E stack trace>
      

      This is leading to a connection leak. Because we use CQSI to create the Phoenix Connection here, it also gets accounted for during open Phoenix connection throttling, thus leaving the client application with less connections that can be opened.

      Attachments

        1. PHOENIX-5802-4.x-v1.patch
          128 kB
          Chinmay Kulkarni
        2. PHOENIX-5802-4.x-v2.patch
          146 kB
          Chinmay Kulkarni

        Issue Links

          Activity

            People

              ckulkarni Chinmay Kulkarni
              ckulkarni Chinmay Kulkarni
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 10m
                  3h 10m