-
-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion fail in macOS (#1609 regression) #1611
Comments
Trying to diagnose this one by myself. The assertion error happens only when the "Hide userland process threads" option is off (i.e. show the threads), and the error happens on htop's own thread. See the screenshot. And there is one thing strange with #1609 in which many processes now show with the status "R" while they should be "S" (sleeping) instead. This is shown on the same screenshot. ![]() Cc: @aestriplex |
Have a look at the value passed to Also, make sure you rebuild clean, to avoid some old object files from interfering. |
@BenBE I did rebuild everything. And by reverting the changes of that PR, htop works again (no assertion error), even though many processes' statuses show "?" instead. |
What values do you see for the arguments in |
That thread didn't get through |
There's something I am missing. The function |
@aestriplex It's hard to answer this one. What I see is two entries for Trying to explain this with a tree view (this screenshot shows the process states without the #1609 patch): ![]() |
@aestriplex The noise to stderr in c808fd8 is a debugging help for you right? |
@Explorer09 cc @BenBE The main problem is that when you let stop show the threads, it shows a thread with a strange PID, that does not exists. In the sshot attached here, for instance, it has PID 111919, that clearly violates the constraint in if (pid > Platform_getMaxPid()) {
fprintf(stderr, "PID %d found\n", pid);
} I don't know if this process id artificially attached for a reason, but the problem is that it has status code 0. A possible workaround then (the one implemented here) is just to set |
@fasterit Yes, I let this lines as debugging help |
@fasterit @BenBE @aestriplex Even though the assertion error is gone now. I still see two issues with the process table:
For the second point, should I file another issue for this, or are you already investigating what happened? ![]() |
@Explorer09 The thread with the strange ID shows status '?' because of the this fix, that sets UNKNOWN to the new processes in the init function. Yes, It shows the running state even for processes that, strictly speaking, should be in state S. Those are the states retrieved by macOS apis though. I got them from the kinfo structure. I tried to get them from the struct proc_bsdinfo pbsd;
if (sizeof(pbsd) == proc_pidinfo(Process_getPid(&proc->super), PROC_PIDTBSDINFO, 0, &pbsd, sizeof(pbsd))) {
proc->super.state = DarwinProcess_mapDarwinProcessState(pbsd.pbi_status)
} |
To investigate why the states all show Another option is that OSX interprets "running" differently and means "is able to run" while an active "is executing" might yield a different value we currently don't look for. |
@BenBE For what concerns the I am investigating better the |
I think I came up with something.
I also attach here a small program to create zombie processes for debug purposes (zombie.c.zip). |
I noticed that It's easy to test the Stopped state. Start a long running command in the terminal, press |
@Explorer09 Thanks, I added the |
Yes. A new PR for this would be fine. The current workaround mostly re-establishes a non-crashing state; and as I understand does not change much compared to before. With the planned changes we'd actually get an improvement. |
This deduces the RUNNING state from the proc_taskinfo structure by using the number of running threads.
This deduces the RUNNING state from the proc_taskinfo structure by using the number of running threads. Fixes: htop-dev#1611
Just built the release candidate of htop-3.4.0 (b1474aa) on macOS Sequoia, and this is what I got:
It's a regression of #1609.
The text was updated successfully, but these errors were encountered: