Open imbdb opened 1 month ago
@imbdb what linux distribution are you using?
And, what is the output of
ps -axo pid,ppid,pcpu,pmem,comm
on this machine (console)
Operating System:
─────────────────────────────────
Platform : linux
Distro : Ubuntu
Release : 22.04.4 LTS
Codename : jammy
Kernel : 6.5.0-1015-aws
Arch : arm64
Truncated output of
ps -axo pid,ppid,pcpu,pmem,comm
PID PPID %CPU %MEM COMMAND
1 0 1.3 0.1 systemd
2 0 0.0 0.0 kthreadd
3 2 0.0 0.0 rcu_gp
4 2 0.0 0.0 rcu_par_gp
5 2 0.0 0.0 slub_flushwq
6 2 0.0 0.0 netns
8 2 0.0 0.0 kworker/0:0H-events_highpri
9 2 0.0 0.0 kworker/0:1-inode_switch_wbs
10 2 0.0 0.0 kworker/u4:0-ext4-rsv-conversion
11 2 0.0 0.0 mm_percpu_wq
12 2 0.0 0.0 rcu_tasks_rude_kthread
13 2 0.0 0.0 rcu_tasks_trace_kthread
@imbdb can you test the latest version 5.23.5?
The function is returning a value now. For some reason, I thought it would return the process list, but it returned a single element in the array.
[
{
proc: '',
pid: 0,
pids: [
0, 4,
... 546 more items
],
cpu: 99.99999999999963,
mem: 84.50729697417735
}
]
I think it would be better to use the processes
function instead, right?
@imbdb ... well it SHOULD return an array of all processes. I testet it on a machine running the same os:
Platform : linux
Distro : Ubuntu
Release : 22.04.3 LTS
Codename : jammy
This is the code I am running:
let si = require('systeminformation');
si.processLoad('*').then( v => console.log(v))
And here what It returns on my side (truncated):
[
{ proc: 'systemd', pid: 1, pids: [ 1 ], cpu: 0, mem: 0 },
{ proc: 'kthreadd', pid: 2, pids: [ 2 ], cpu: 0, mem: 0 },
{ proc: 'rcu_gp', pid: 3, pids: [ 3 ], cpu: 0, mem: 0 },
{ proc: 'rcu_par_gp', pid: 4, pids: [ 4 ], cpu: 0, mem: 0 },
{ proc: 'slub_flushwq', pid: 5, pids: [ 5 ], cpu: 0, mem: 0 },
{ proc: 'netns', pid: 6, pids: [ 6 ], cpu: 0, mem: 0 },
{
proc: 'kworker',
pid: 3710814,
pids: [
8, 24, 30, 36, 42, 48,
54, 60, 66, 72, 78, 84,
90, 96, 102, 108, 176, 212,
240, 256, 305, 308, 311, 314,
316, 318, 335, 373, 445, 507,
536, 545, 567, 2886818, 2966220, 3064270,
3098483, 3239607, 3331446, 3360939, 3386264, 3390085,
3476770, 3511405, 3576747, 3585047, 3598985, 3600025,
3602953, 3611411, 3642134, 3642299, 3671666, 3678637,
3679710, 3679727, 3690006, 3696258, 3696745, 3699178,
3699179, 3699468, 3700659, 3704186, 3708115, 3708794,
3709638, 3710360, 3710631, 3710814
],
cpu: 0,
mem: 0
},
...
]
Hmmmm ... I reopened the ticket ...
@imbdb is there any chance, that you can help with debugging? That would mean adding certain console.log
into the systeminformation code. If yes, I would guide you, what I would need.
Sure @sebhildebrandt
@imbdb thank you so much!
So, if you clone the repo with
git clone https://github.com/sebhildebrandt/systeminformation.git
cd systeminformation
Then edit the lib/processes.js
file. Line 1138 to 1290 is where the magic happens ;-)
SO let us have a look:
procStats
variable (as an array). If you do a console log after line 1166 with console.log(procStats
) you should the see all processes. This should be true on your machine.result
array ... for the first entry this should be false as the result array is empty. But if we find the process name in the result
array, we remember the index in the array.proc
= '*'
this should not be the case so inlist
stays false
...processString
(which is basically the same as the proc
parameter after sanitation) equals *
we should enter this if
clause. listpos
should be -1
as long as we do not have the process ib our list ... and if we have a name
for the process (line 1186) we add the process to the result
array. For some reason this last part only happens once. Here it would be interesting to check the conditions WHY this part is not called again. Looking at your result this is anyway strange as there should never be an item in the result with name = ''
... I only allow to add items to the result array if there IS a name (line 1186). Can you try to check the conditions here and post back, what you found out?
Thank you!
@imbdb did you had time to have a look on it on your side? I tested it here on different machines and different OS versions without any issue ... so it would be interesting to see what the reason is on your machine. Thank you in advance.
Hello @sebhildebrandt
Give me sometime (max 2 days), stuck in some issues right now.
Hi @imbdb ... sorry I didn't wanted to stress you! Take your time ;-)
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
processLoad('*')
Current Output No output, it just keeps waiting.
Expected behavior It should return list of all the current processes
Environment (please complete the following information):