Loading

How to use "lsof" command for a specific process id to identify the number of open files

Veröffentlichungsdatum: Mar 2, 2024
Lösung

SYMPTOM

The lsof command without any process id gives huge output. The information is not specific and has too much data which make analyzing issue tougher.

CAUSE

The lsof command on a machine would return open files by all the users on the server. A server with multiple processes and users would give an extremely high number of open files which makes it tough to analyze the Mule issue specifically

SOLUTION

Each file descriptor is associated with a process ID.  Using the lsof -p <processID> command, the files opened by a particular process can be checked. 
 
Please run the lsof as below,
lsof -p <PID>
With that, we can check if we have a more accurate number of open files for that process. 

ADDITIONAL INFORMATION

There are restrictions on the lsof tool, that duplicates entries by a thread. Based on the following external resources, the way to get the real number by process depends on the lsof version or using the process id.

Understanding File Descriptors usage
LSOF output is showing duplicates
lsof -p PID vs lsof | grep PID
 
Nummer des Knowledge-Artikels

001120356

 
Laden
Salesforce Help | Article