Bug 15524

Summary: AB-INT PTEST: strace ptest failure: in nanosleep.gen
Product: [QA/Testing] Package Testing (ptest) Reporter: João Marcos Costa <joaomarcos.costa>
Component: ptestAssignee: Kris Gavvala <kris.gavvala>
Status: ACCEPTED --- QA Contact:
Severity: normal    
Priority: Medium+ CC: alexandre.belloni, Derald.Woods, osama.abdelkader, randy.macleod, ross.burton
Version: unspecified   
Target Milestone: 6.2 M1   
Hardware: x86   
OS: Multiple   
Whiteboard: AB-INT
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
proposed fix none

Description João Marcos Costa 2024-06-20 08:06:47 UTC
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6731/steps/13/logs/stdio

Failed ptests:
{'strace': ['nanosleep.gen.test', 'nanosleep.gen']}

qemux86-64-ptest opensuse154-ty-2
Comment 1 Alexandre Belloni 2024-06-20 14:46:19 UTC
FAIL: nanosleep.gen
===================

nanosleep: /usr/src/debug/strace/6.9/tests/nanosleep.c:114: main: Assertion `k_nanosleep(&req.ts, &rem.ts) == -1' failed.
Aborted
nanosleep({tv_sec=0, tv_nsec=789985}, NULL) = 0
nanosleep(NULL, 0x7ffe7d8e98f0) = -1 EFAULT (Bad address)
nanosleep({tv_sec=0, tv_nsec=789985}, 0x7ffe7d8e98f0) = 0
nanosleep({tv_sec=0, tv_nsec=1000000000}, 0x7ffe7d8e98f0) = -1 EINVAL (Invalid argument)
nanosleep({tv_sec=3735928559, tv_nsec=4207869677}, 0x7ffe7d8e98f0) = -1 EINVAL (Invalid argument)
nanosleep({tv_sec=-3819351491602432273, tv_nsec=13464652301697220333}, 0x7ffe7d8e98f0) = -1 EINVAL (Invalid argument)
nanosleep({tv_sec=-1, tv_nsec=18446744073709551615}, 0x7ffe7d8e98f0) = -1 EINVAL (Invalid argument)
nanosleep({tv_sec=0, tv_nsec=999999999}, 0x7ffe7d8e98f0) = 0
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=14133, si_uid=0} ---
+++ killed by SIGABRT +++
nanosleep.gen.test: failed test: ../../src/strace -e trace=nanosleep -a20 ../nanosleep failed with code 134
FAIL nanosleep.gen.test (exit status: 1)
Comment 2 Ross Burton 2024-06-20 14:52:34 UTC
Smells like a load-sensitive test that we should just skip to me...
Comment 3 Randy MacLeod 2025-01-09 16:06:54 UTC
Has not happened in 6 months.
Comment 4 João Marcos Costa 2025-03-25 08:46:58 UTC
https://autobuilder.yoctoproject.org/valkyrie/#/builders/61/builds/1180/steps/12/logs/stdio

Failed ptests:{'strace': ['nanosleep.gen.test', 'nanosleep.gen']}

qemuarm64-ptest ubuntu2410-vk-arm1

Reopening.
Comment 5 João Marcos Costa 2025-06-03 09:19:37 UTC
https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/1605/steps/12/logs/stdio

qemux86-64-ptest fedora40-vk-2
Comment 6 João Marcos Costa 2025-07-08 09:17:01 UTC
https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/1857/steps/12/logs/stdio

Failed ptests:{'strace': ['nanosleep.gen.test', 'nanosleep.gen']}

qemux86-64-ptest ubuntu2204-vk-1
Comment 7 Randy MacLeod 2025-08-14 16:03:21 UTC
Move to M3 and CC Osama in case he has time to either skip the test, extend the timeout, or talk to upstream about how strace should not have shortish timeouts by default since testing environments may be heavily CPU loaded.
Comment 8 Osama Abdelkader 2025-08-15 20:09:28 UTC
Thanks Randy for CC my, I will take a look.
Comment 9 Osama Abdelkader 2025-08-18 21:24:56 UTC
I can't find this bug anymore in recent builds after upgrading strace to 6.16

https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/2129/steps/12/logs/stdio


Can you please re-check?

BR,
Osama
Comment 10 Randy MacLeod 2025-08-19 00:48:05 UTC
Hi Osama,

Thanks for checking. The bugs with the "Whiteboard" label of AB-INT mostly or 
only happen in the YP autobuilder environment. We deliberately run 2 builds per machine to get good throughput and we run the ptests in parallel as well. 
We do try to limit the build load using:
   https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json
which pulls in:
   https://git.openembedded.org/openembedded-core/tree/meta/conf/fragments/yocto-autobuilder/autobuilder-resource-constraints.conf
so you may have trouble reproducing the error.

The test seems to be generated since it's in nanosleep.gen.test and from a quick look at: tests/gen_tests.in

Assuming that it's generated, and looking for nanosleep in 
strace.git/master, 
I see only test/nanosleep.c and note that it hasn't has a significant commit in Aug 2023:

❯ gl -4 tests/nanosleep.c 
144176806   2023-09-01   Update copyright headers
7178658ea   2023-08-31   tests: avoid libc definition for time_t in direct syscalls
8fa8a8886   2021-02-16   Update copyright headers
9d9e66299   2020-12-31   Change my email address


Anyway, as you can see it's a rare failure, we tried to just assume that it went away one but it came back so the recommendation is to extend the timeout or skip the test by patching the code. It would be interesting to know what the return code of 134 is - EINTR, maybe?
https://man7.org/linux/man-pages/man2/nanosleep.2.html

That's all the time I have tonight... any ideas?
Comment 11 Osama Abdelkader 2025-08-19 10:41:58 UTC
Hi Randy,

Thanks for your check. I'm going to check it more in details and create a patch to extend the timeout.

BR
Comment 12 Osama Abdelkader 2025-08-29 23:05:51 UTC
Created attachment 5137 [details]
proposed fix
Comment 13 Osama Abdelkader 2025-08-29 23:07:30 UTC
Hi Randy,

Please find the patch to skip that test, I found already 
a patch that skips load-sensitive tests, so I added nanosleep to it.

BR,
Osama