raulcd opened a new issue, #50684:
URL: https://github.com/apache/arrow/issues/50684

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   A `FlightServerBase`, even after `shutdown()`, `wait()` and dropping the 
last user reference, doesn't seem to be completely freed. It stays alive and 
leaks.
   
   Applications that create a Flight server per unit of work (one per build, 
per request batch, per test) accumulate one zombie server per cycle.
   
   ```python
   $ uv run python
   Python 3.14.2 (main, Jan 14 2026, 19:38:07) [Clang 21.1.4 ] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import gc
   ... import pyarrow.flight as fl
   ... 
   ... class Server(fl.FlightServerBase):
   ...     pass
   ... 
   ... for _ in range(100):
   ...     server = Server("grpc://127.0.0.1:0")
   ...     server.payload = bytearray(8 * 1024 * 1024)
   ...     server.shutdown()
   ...     server.wait()
   ...     del server
   ...     gc.collect()
   ... 
   ... print(sum(1 for o in gc.get_objects() if isinstance(o, Server)))
   ... 
   100
   >>> import pyarrow
   >>> pyarrow.__version__
   '25.0.0'
   ```
   
   RSS grows ~8 MB per iteration, tracking the payload one for one. The same 
loop with a plain Python object instead of a Flight server keeps RSS flat and 
prints `0`.
   
   Without a payload the loop still leaks about 66 kB RSS and 12 to 16 MB of 
virtual address space per iteration. An equivalent C++ loop creating and 
shutting down a Flight server shows no growth, so this points at an issue in 
the Python bindings.
   
   ### Component(s)
   
   FlightRPC, Python


-- 
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]

Reply via email to