Automatic merge from submit-queue Revert revert 30090 with fix This reverts #31297 (which originally reverted #30090) and applies a fix to stop the fd leak that was exposed by #30090.