Hello Stephen, On Sat, 17 Oct 2026 at 22:36, Stephen Hemminger <[email protected]> wrote: > > Running testpmd with an i40e device on 26.11-rc1 prints a set of FD > leak warnings on port close and on exit: > > Closing ports... > EAL: Some interrupt handle is leaking a FD: 19 > EAL: Some interrupt handle is leaking a device FD: 18 > Port 0 is closed > ... > Bye... > EAL: Some interrupt handle is leaking a FD: 20 > EAL: Some interrupt handle is leaking a device FD: 18 > EAL: Some interrupt handle is leaking a device FD: 18 > EAL: Some interrupt handle is leaking a FD: 7 > EAL: Some interrupt handle is leaking a FD: 7 > > The warning is new in 26.11 (commit d770ee9caed0, "interrupts: warn on > leaked FDs"). It is doing its job - one of these is a real leak - but > most of what it reports here is not, and the noise will get reported as > a regression. > > There are three distinct causes. > > The interrupt source created by rte_intr_callback_register() keeps a > copy of the caller's handle. The copy carries the caller's fd and > dev_fd, but does not own them, so freeing the source complains about > fds that the caller still holds and will close itself. > > The VFIO device fd is closed by dev_vfio_release_device() on unmap, > but is left behind in the interrupt handle, so freeing the handle later > reports an fd that is already closed. The VFIO request handle holds the > same fd and has the same problem. > > The alarm timerfd is a real leak: it is never closed on EAL cleanup. > FreeBSD was already fixed for this; Linux was not. > > Patches 1 and 2 address the bogus warnings, patch 3 the actual leak. > With all three applied the same testpmd run shuts down cleanly with no > warnings.
Thanks for those fixes. > > Open questions: > > - Patch 1 clears the fds in the source's copy of the handle. Clearing > them at dup time, or not duplicating the fds into the source at all, > may be the better fix. Re-reading this code, it is the only place where we duplicate the *handle* and it seems entirely unneeded to me. The interrupt subsystem can not release the handle object itself (which is probably why it works on a duplicate object). The original intr_handle is allocated by a driver (through the bus code, usually), and registered to the interrupt subsytem. So simply, this whole duplicate handle stuff can go away, and the ownership is still the drivers and not the interrupt subsystem. Am I missing some other case? > - Patch 2 resets dev_fd at the two unmap sites. Doing it inside > dev_vfio_release_device(), next to the close, would cover any other > caller. The current fix is a symetric to the map path, where the VFIO subsystem gives back to the PCI bus a device FD tracked in the interrupt handle object of the PCI device object. The VFIO subsytem has no idea about the intr handle stuff. All it knows about is the device FD, which seems correctly closed by VFIO on call to dev_vfio_release_device() indeed. I don't see why it should change, can you clarify? -- David Marchand

