arnoldwakim opened a new issue, #435:
URL: https://github.com/apache/arrow-go/issues/435

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Hey everyone,
   
   As this is my first time discussing on this repository, kindly forgive me in 
case of a mistake.
   
   While exploring Arrow Flight SQL servers with DuckDB, I came across an issue.
   
   Let's assume we have a Flight SQL client that sends SQL queries to a 
FlightSQL server, while the data is being streamed [here (sqlite 
example)](https://github.com/apache/arrow-go/blob/b196d3b316d09f63786f021d4f1baa1fdd7620d2/arrow/flight/flightsql/example/sqlite_server.go#L488),
 if the client receives a non handled SIGINT, the communication between server 
and client stops (without a cancel request), and the server catches the error 
[here](https://github.com/apache/arrow-go/blob/b196d3b316d09f63786f021d4f1baa1fdd7620d2/arrow/flight/flightsql/server.go#L928).
   However, I still have an arrow array somewhere buffered in memory (server 
side) and the record reader that has not been released and therefore I still 
have arrow arrays in the wild waiting to be `free`d.
   
   When modifying the source code 
[here](https://github.com/apache/arrow-go/blob/b196d3b316d09f63786f021d4f1baa1fdd7620d2/arrow/flight/flightsql/server.go#L928),
 while checking for an error adding a for loop that exhaust the channel to 
release the StreamChunk resolves the issue.
   
   ```go
   func exhaustChannelAndReleaseStreamChunks(cc <-chan flight.StreamChunk) {
        for chunk := range cc {
                chunk.Data.Release()
        }
   }
   ```
   
   ```go
   if err = wr.WriteWithAppMetadata(chunk.Data, chunk.AppMetadata); err != nil {
       exhaustChannelAndReleaseStreamChunks(cc)
       return err
   }
   ```
   
   Did I misunderstand something?
   I can take care of the PR if need be.
   I've been testing that manually. Do you think I can test the behaviour 
rigorously?
   
   Thank you for your time.
   
   ### Component(s)
   
   Other


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to