Skip to content
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

fix: expect less of kernel, sleep longer in tests #10

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

limeytexan
Copy link
Contributor

@limeytexan limeytexan commented Jan 30, 2025

Observed repeated CI test failures running on aarch64-linux instances:

  > Failed test tests/100-lines
  > --- tests/100-lines.log      1970-01-01 00:00:01.000000000 +0000
  > +++ /build/tmp.Xnq7ZeMG7J/100-lines.log    2025-01-29 15:07:16.278776269 +0000
  > @@ -49,8 +49,8 @@
  >  line 25 to stdout
  >  line 25 to stderr
  >  line 26 to stdout
  > -line 26 to stderr
  >  line 27 to stdout
  > +line 26 to stderr
  >  line 27 to stderr
  >  line 28 to stdout
  >  line 28 to stderr
  > make: *** [Makefile:137: tests/100-lines/log] Error 1

This occurs when the kernel actually delivers messages out of order to the stdout and stderr file descriptors, which is very much possible for the Linux kernel.

There's really no resolution for this apart from lowering our expectations, and this patch roughly triples the time spent sleeping between lines sent to stdout/stderr by changing sleep 0 to sleep 0.01:

  $ time sleep 0
  real    0m0.003s
  user    0m0.004s
  sys     0m0.000s

  $ time sleep 0.01
  real    0m0.013s
  user    0m0.002s
  sys     0m0.001s

Observed repeated test failures on CI running on aarch64-linux instances:

  > Failed test tests/100-lines
  > --- tests/100-lines.log      1970-01-01 00:00:01.000000000 +0000
  > +++ /build/tmp.Xnq7ZeMG7J/100-lines.log    2025-01-29 15:07:16.278776269 +0000
  > @@ -49,8 +49,8 @@
  >  line 25 to stdout
  >  line 25 to stderr
  >  line 26 to stdout
  > -line 26 to stderr
  >  line 27 to stdout
  > +line 26 to stderr
  >  line 27 to stderr
  >  line 28 to stdout
  >  line 28 to stderr
  > make: *** [Makefile:137: tests/100-lines/log] Error 1

This occurs when the kernel _actually_ delivers messages out of order to
the stdout and stderr file descriptors, which is very much possible for
the Linux kernel.

There's really no resolution for this apart from lowering our expectations,
and this patch roughly triples the time spent sleeping between lines sent to
stdout/stderr by changing `sleep 0` to `sleep 0.01`:

  $ time sleep 0
  real    0m0.003s
  user    0m0.004s
  sys     0m0.000s

  $ time sleep 0.01
  real    0m0.013s
  user    0m0.002s
  sys     0m0.001s
@limeytexan limeytexan requested a review from ysndr January 30, 2025 14:58
Copy link
Contributor

@ysndr ysndr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sleep 0 is pretty short indeed, an infinite increase to 0.1 seems fine

@limeytexan limeytexan merged commit 7420ba5 into main Jan 30, 2025
4 checks passed
@limeytexan limeytexan deleted the fix/sleep-longer branch January 30, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants