You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now the problem occurs. Since we have the count parameter set to 1 in GetInfoForPid and FillPidMetrics, we have a matching IndexPointer==pi_pid at least in all of my tests with:
Now I'm not sure if IndexPointer==pi_pid can be guaranteed for count=1 and in my opinion, we should assert the requested pid matches the info.pi_pid in the CGo functions.
But also if the process/pid was stopped in the mean time, usually the resulting ProcessBuffer has info.pi_state=Running set, which is wrong.
Therefore: Do we need to ensure that the PID exists before calling of especially GetInfoForPid or should the GetInfoForPid be modified to check first if the process exists by iterating through the getprocs index pointer? I think the second option behaves more similar to the Linux version.
I'm asking this because I'm implementing AIX support for process.GetPIDState.
The text was updated successfully, but these errors were encountered:
Hi
getprocs uses an
IndexPointer
under AIX, which doesn't need to correlate in every case to the PID.The usage is correct in
FetchPids
, where we start with 0 and iterate through the process table:elastic-agent-system-metrics/metric/system/process/process_aix.go
Lines 46 to 52 in 406673b
But in
GetInfoForPid
we are using theIndexPointer
as the pid:elastic-agent-system-metrics/metric/system/process/process_aix.go
Lines 66 to 70 in 406673b
And in
FillPidMetrics
the same:elastic-agent-system-metrics/metric/system/process/process_aix.go
Lines 113 to 118 in 406673b
Now the problem occurs. Since we have the
count
parameter set to 1 inGetInfoForPid
andFillPidMetrics
, we have a matchingIndexPointer==pi_pid
at least in all of my tests with:Now I'm not sure if
IndexPointer==pi_pid
can be guaranteed forcount=1
and in my opinion, we should assert the requested pid matches theinfo.pi_pid
in the CGo functions.But also if the process/pid was stopped in the mean time, usually the resulting
ProcessBuffer
hasinfo.pi_state=Running
set, which is wrong.Therefore: Do we need to ensure that the PID exists before calling of especially
GetInfoForPid
or should theGetInfoForPid
be modified to check first if the process exists by iterating through thegetprocs
index pointer? I think the second option behaves more similar to the Linux version.I'm asking this because I'm implementing AIX support for
process.GetPIDState
.The text was updated successfully, but these errors were encountered: