[Elastic] FileStore rendezvous leaks the mkstemp file descriptor
#191 394 ouverte le 28 juil. 2026
Métriques du dépôt
- Stars
- (102 492 étoiles)
- Métriques de merge PR
- (Merge moyen 1j 10h) (42 PRs mergées en 30 j)
Description
Problem
On current main (5d242823c6de2bbc21d636b2995a38340bd2a16c), _create_file_store() calls tempfile.mkstemp() when no endpoint is supplied but discards the returned file descriptor without closing it.
Relevant code: c10d_rendezvous_backend.py.
FileStore opens the path independently, so the descriptor created by mkstemp() remains owned by the Python process and is leaked.
Reproduction
Mock tempfile.mkstemp() to return a known descriptor and valid temporary path, call _create_file_store() without an endpoint, and observe that os.close() is never called for that descriptor. Repeated rendezvous creation also increases the process's open-FD count.
Expected behavior
Close the descriptor returned by mkstemp() after retaining the path, including appropriate handling if subsequent FileStore construction fails.
Impact
Repeated FileStore rendezvous creation consumes file descriptors and can eventually hit the process limit.
Suggested regression test
Patch mkstemp() and os.close(), construct the backend with no endpoint, and assert that the exact returned descriptor is closed once while the temporary path is passed to FileStore.
cc @dzhulgakov @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @pragupta @msaroufim @dcci @aditvenk @weifengpy @kapilsh