saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.1k stars 5.47k forks source link

[BUG] minion using multiprocessing will leek pipe fd #66726

Open liangyihong opened 2 months ago

liangyihong commented 2 months ago

Description While minion config multiprocessing is True, parent process will leek fd, because multiprocessing using popen. In class SubprocessList , it's function cleanup need to add proc.join() if using multiprocessing , to clean parent process fd(pipe).

welcome[bot] commented 2 months ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

dwoz commented 1 month ago

@liangyihong I see join getting called here: https://github.com/saltstack/salt/blob/3006.x/salt/utils/process.py#L1175

liangyihong commented 1 month ago

@liangyihong I see join getting called here: https://github.com/saltstack/salt/blob/3006.x/salt/utils/process.py#L1175

@dwoz Sorry, that was a typo. It need to add proc.close() to clean parent process fd(pipe).In python3, package multiprocessing/popen_fork.py, the class Popen need call close() to clean parent pipe fd.

dwoz commented 1 month ago

@liangyihong I see join getting called here: https://github.com/saltstack/salt/blob/3006.x/salt/utils/process.py#L1175

@dwoz Sorry, that was a typo. It need to add proc.close() to clean parent process fd(pipe).In python3, package multiprocessing/popen_fork.py, the class Popen need call close() to clean parent pipe fd.

Makes sense, thanks.