public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tst-epoll: increase waiting time before sending signal to the child
@ 2024-01-23 21:11 Aurelien Jarno
  2024-01-23 22:23 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Jarno @ 2024-01-23 21:11 UTC (permalink / raw)
  To: libc-alpha; +Cc: Aurelien Jarno

When running the testsuite in parallel, for instance running make -j
$(nproc) check, from time to time tst-epoll fails with a timeout. It
happens because it sometimes takes a bit more than 10ms for the process
to get cloned and blocked by the syscall. In that case the signal is
sent to early, and the test fails with a timeout. This happens even on
fast hosts.

This patch increases the waiting time to 100ms to make it more reliable.
It corresponds to 20% of the epoll wait time, so there is still some
margin on that side.
---
 sysdeps/unix/sysv/linux/tst-epoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/tst-epoll.c b/sysdeps/unix/sysv/linux/tst-epoll.c
index 3b38beae6e..39953c0a08 100644
--- a/sysdeps/unix/sysv/linux/tst-epoll.c
+++ b/sysdeps/unix/sysv/linux/tst-epoll.c
@@ -98,7 +98,7 @@ test_epoll_basic (epoll_wait_check_t epoll_wait_check)
   xclose (fds[1][1]);
 
   /* Wait some time so child is blocked on the syscall.  */
-  nanosleep (&(struct timespec) {0, 10000000}, NULL);
+  nanosleep (&(struct timespec) {0, 100000000}, NULL);
   TEST_COMPARE (kill (p, SIGUSR1), 0);
 
   int e = epoll_wait_check (efd, &event, 1, 500000000, &ss);
-- 
2.42.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tst-epoll: increase waiting time before sending signal to the child
  2024-01-23 21:11 [PATCH] tst-epoll: increase waiting time before sending signal to the child Aurelien Jarno
@ 2024-01-23 22:23 ` Andreas Schwab
  2024-01-23 23:13   ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2024-01-23 22:23 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: libc-alpha

On Jan 23 2024, Aurelien Jarno wrote:

> When running the testsuite in parallel, for instance running make -j
> $(nproc) check, from time to time tst-epoll fails with a timeout. It
> happens because it sometimes takes a bit more than 10ms for the process
> to get cloned and blocked by the syscall. In that case the signal is
> sent to early, and the test fails with a timeout. This happens even on
> fast hosts.
>
> This patch increases the waiting time to 100ms to make it more reliable.
> It corresponds to 20% of the epoll wait time, so there is still some
> margin on that side.

Can this be synchronized properly?  A racy test is worthless.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tst-epoll: increase waiting time before sending signal to the child
  2024-01-23 22:23 ` Andreas Schwab
@ 2024-01-23 23:13   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella Netto @ 2024-01-23 23:13 UTC (permalink / raw)
  To: Andreas Schwab, Aurelien Jarno; +Cc: libc-alpha



On 23/01/24 19:23, Andreas Schwab wrote:
> On Jan 23 2024, Aurelien Jarno wrote:
> 
>> When running the testsuite in parallel, for instance running make -j
>> $(nproc) check, from time to time tst-epoll fails with a timeout. It
>> happens because it sometimes takes a bit more than 10ms for the process
>> to get cloned and blocked by the syscall. In that case the signal is
>> sent to early, and the test fails with a timeout. This happens even on
>> fast hosts.
>>
>> This patch increases the waiting time to 100ms to make it more reliable.
>> It corresponds to 20% of the epoll wait time, so there is still some
>> margin on that side.
> 
> Can this be synchronized properly?  A racy test is worthless.
> 


Maybe either:

  static pthread_barrier_t *barrier;
  shared_data = support_shared_allocate (sizeof (*shared_data));
  {
    pthread_barrierattr_t attr;
    xpthread_barrierattr_init (&attr);
    xpthread_barrierattr_setpshared (&attr, PTHREAD_PROCESS_SHARED);
    xpthread_barrier_init (barrier, &attr, 2);
    xpthread_barrierattr_destroy (&attr);
  }

  /* Child.  */
  xpthread_barrier_wait (&barrier);
  epoll_ctl (...)

  /* Parent.  */
  xpthread_barrier_wait (&barrier);
  kill (...)

Or:

  /* Parent.  */
  support_process_state_wait (pid, support_process_state_sleeping);
  kill (...)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-23 23:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 21:11 [PATCH] tst-epoll: increase waiting time before sending signal to the child Aurelien Jarno
2024-01-23 22:23 ` Andreas Schwab
2024-01-23 23:13   ` Adhemerval Zanella Netto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).