In /proc/pid/fd/, there are too many file descriptors. Can I use shell command to close these file descriptors?
Join Stack Overflow to learn, share knowledge, and build your career.
|
|
|||||
|
|
I've ran in a similar situation, but where So I came up with a quick
|
|||||
|
|
You can definitely close fd's of other running processes as long as you have the permissions to do so. First, find the PID. Then, start gdb and attach to the process:
Then, call the close system call on the fd you want to close:
If the file descriptor was a leaked one, then the program will never try to use it again anyway, and it shouldn't cause any issues. The program most likely has a bug, however. |
|||
|
|
|
You can't just go around closing other processes' file descriptors and expect them to keep working. Fix the program which has too many files open to make it open fewer. This may be a config change, or modifying the source etc. You can't just close the files for it. |
|||||||||
|
|
You can close a FD
|
|||||
|