[Bug 1871129] Re: htop is blank when using in focal in wsl1

Balint Reczey 1871129 at bugs.launchpad.net
Wed Aug 5 16:14:12 UTC 2020


** Description changed:

  [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 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;
+       	clock_gettime(CLOCK_REALTIME, &ts);
+ 	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_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &ts, &rem);
+ 
+ 	printf("sleep 1.2s\n");
+ 	ts.tv_sec = 1;
+ 	ts.tv_nsec = 200000000L;
+ 	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);
+ 
+ 	printf("sleep 1.2s with CLOCK_MONOTONIC\n");
+ 	ts.tv_sec = 1;
+ 	ts.tv_nsec = 200000000L;
+ 	clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &rem);
+ 
+ 	printf("invalid sleep -1s (+200ms)\n");
+ 	ts.tv_nsec = 200000000L;
+ 	ts.tv_sec = -1;
+ 	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);
+ 
+ 	printf("invalid sleep 1s (-200ms)\n");
+ 	ts.tv_nsec = -200000000L;
+ 	ts.tv_sec = 1;
+ 	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);
+ 
+ 	printf("invalid sleep 0s (+1.200ms as nsec)\n");
+ 	ts.tv_nsec = 1200000000L;
+ 	ts.tv_sec = 1;
+ 	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);
+ 
+ }
+ 
  [Regression Potential]
  
  The fix is falling back to using monotonic time ... FIXME
- 
  
  [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://user-images.githubusercontent.com/15316889/78563857-31697b00
  -784e-11ea-9f21-338a6cf8cb23.gif
  
  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.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1871129

Title:
  htop is blank when using in focal in wsl1

Status in Ubuntu WSL:
  In Progress
Status in glibc package in Ubuntu:
  Fix Committed
Status in htop package in Ubuntu:
  Invalid

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 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;
        	clock_gettime(CLOCK_REALTIME, &ts);
  	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_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &ts, &rem);

  	printf("sleep 1.2s\n");
  	ts.tv_sec = 1;
  	ts.tv_nsec = 200000000L;
  	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);

  	printf("sleep 1.2s with CLOCK_MONOTONIC\n");
  	ts.tv_sec = 1;
  	ts.tv_nsec = 200000000L;
  	clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &rem);

  	printf("invalid sleep -1s (+200ms)\n");
  	ts.tv_nsec = 200000000L;
  	ts.tv_sec = -1;
  	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);

  	printf("invalid sleep 1s (-200ms)\n");
  	ts.tv_nsec = -200000000L;
  	ts.tv_sec = 1;
  	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);

  	printf("invalid sleep 0s (+1.200ms as nsec)\n");
  	ts.tv_nsec = 1200000000L;
  	ts.tv_sec = 1;
  	clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem);

  }

  [Regression Potential]

  The fix is falling back to using monotonic time ... FIXME

  [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://user-images.githubusercontent.com/15316889/78563857-31697b00
  -784e-11ea-9f21-338a6cf8cb23.gif

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntuwsl/+bug/1871129/+subscriptions



More information about the foundations-bugs mailing list