GJ100 opened a new pull request, #65311:
URL: https://github.com/apache/doris/pull/65311

   ```
   ### What problem does this PR solve?
   
   Issue Number: close #<65305>
   
   Problem Summary:
   
   `DorisFlightSqlProducer#createPreparedStatement` creates two 
`VectorSchemaRoot`
   instances (an empty one for the parameter schema, and one from
   `FlightSqlChannel#createOneOneSchemaRoot(...)` for the result metadata),
   extracts only their `Schema`, and never closes them.
   
   `createOneOneSchemaRoot` allocates a `VarCharVector` from the channel
   `RootAllocator` (off-heap, Netty pooled direct buffer). Since the returned
   `VectorSchemaRoot` is never closed, its off-heap buffer is leaked on every
   prepare call (effectively every Arrow Flight query, because ADBC prepares 
each
   statement). The buffer cannot be reclaimed by GC (strongly referenced by the
   allocator) nor by closing the client session (`FlightSqlChannel#close()` only
   invalidates the result cache and does not close the allocator; the leaked 
root
   is never stored in any session map).
   
   Under continuous Arrow Flight query load this makes FE direct memory grow
   monotonically until:
   `java.lang.OutOfMemoryError: Cannot reserve ... bytes of direct buffer 
memory (Internal; Prepare)`
   
   This PR wraps both temporary roots in try-with-resources so their off-heap
   buffers are released after the `Schema` is extracted. `Schema` is an 
immutable
   POJO and remains valid after the root is closed. Compare with
   `getCatalogs`/`getSchemas`/`getTables` in the same producer, which already 
use
   try-with-resources.
   
   ### Release note
   
   Fix FE Arrow Flight SQL direct memory leak in createPreparedStatement.
   
   ### Check List (For Author)
   
   - Test
       - [ ] Regression test
       - [ ] Manual test: run many distinct Arrow Flight queries and verify FE
             direct memory / io.netty.buffer.PoolSubpage stays bounded.
   ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to