htop is blank when using in focal in wsl1
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu WSL |
Fix Released
|
Medium
|
Unassigned | ||
glibc (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned | ||
htop (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[Impact]
Programs previously using nanosleep syscall and with glibc 31's update being switched to use clock_nanosleep broke due to clock_nanosleep using CLOCK_REALTIME returns EINVAL in wsl1.
[Test Case]
Run sleep in WSL1 on Windows 10 2004 or older version.
The fixed version works correctly, the not fixed version breaks in Focal.
Run the following program under in WSL1 and on a real kernel with strace and observe that the fallback is applied only when it is needed:
#include <time.h>
#include <stdio.h>
int main (int argc, char ** argv) {
struct timespec ts, rem;
printf("Sleep 1.5s with TIMER_ABSTIME\n");
ts.tv_nsec += 500000000L;
if (ts.tv_nsec > 1000000000L) {
ts.tv_nsec -= 1000000000L;
ts.tv_sec += 1;
}
ts.tv_sec += 1;
clock_
printf("sleep 1.2s\n");
ts.tv_sec = 1;
ts.tv_nsec = 200000000L;
clock_
printf("sleep 1.2s with CLOCK_MONOTONIC
ts.tv_sec = 1;
ts.tv_nsec = 200000000L;
clock_
printf("invalid sleep -1s (+200ms)\n");
ts.tv_nsec = 200000000L;
ts.tv_sec = -1;
clock_
printf("invalid sleep 1s (-200ms)\n");
ts.tv_nsec = -200000000L;
ts.tv_sec = 1;
clock_
printf("invalid sleep 0s (+1.200ms as nsec)\n");
ts.tv_nsec = 1200000000L;
ts.tv_sec = 1;
clock_
}
[Regression Potential]
The fix is falling back to using monotonic time and also converts the clock_nanosleep call to not use TIMER_ABSTIME in the fallback.
If the calculation from absolute to relative time is not correct then it may result in a very long sleep effectively hanging the calling process.
Also the checks in the callback can crash the calling program if a mistake is made.
The program in the [Test] section aims to cover all branches of the fix.
[Original Bug Text]
Right now I am trying Ubuntu 20.04 on WSL and I noticed that when I run htop in WSL 1st generation, it is completely blank:
https:/
The previous version (htop 2.1.0) works without any issue.
I am using htop 2.2.0-2build1 on Ubuntu 20.04 on WSL1 on Windows 10 build 19592.1001.
Changed in wsl (Ubuntu): | |
status: | New → Confirmed |
Changed in glibc (Ubuntu): | |
status: | Confirmed → Invalid |
Changed in htop (Ubuntu): | |
status: | Opinion → Invalid |
importance: | Medium → Undecided |
Changed in glibc (Ubuntu): | |
importance: | Medium → Undecided |
Changed in wsl (Ubuntu): | |
importance: | Undecided → Medium |
affects: | wsl (Ubuntu) → ubuntuwsl |
Changed in ubuntuwsl: | |
assignee: | nobody → Rafael David Tinoco (rafaeldtinoco) |
Changed in ubuntuwsl: | |
assignee: | Rafael David Tinoco (rafaeldtinoco) → nobody |
Changed in glibc (Ubuntu): | |
status: | Invalid → Fix Committed |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in ubuntuwsl: | |
status: | In Progress → Fix Released |
Yep, I was able to confirm this behavior.. will check it soon.