Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-16163

[Go] IPC FileReader leaks memory when used with ZSTD compression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • 8.0.0
    • Go

    Description

      I'll submit a PR

       

      When using the IPC Reader to read data compressed in zstd, we observed what looked like a memory leak.

      After further debugging, we observed that calling the IPC Reader created goroutines that were never stopped, and consumed memory.

       

      After deeper investigation, we found the following root cause:

       

      In arrow/ipc/file_reader.go, the newRecord function calls getDecompressor, that returns a zstd.Decoder object.

       

      When used in its stream version (calling .Read()), this decoder makes use of a Goroutine with a channel to receive input. This channel is closed by the decoder's .Close() function, which ends the Goroutine and therefore the collection of its memory by the GC.

       

      After using the zstd Decoder, the IPC FileReader should close it to prevent the leak.

      Attachments

        Issue Links

          Activity

            People

              cptjacky Nicolas MOREAU
              cptjacky Nicolas MOREAU
              Votes:
              1 Vote for this issue
              Watchers:
              3 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 - 50m
                  50m