On Thu, May 15, 2025 at 10:31:28AM -0700, Andrii Nakryiko wrote:

SNIP

> > +static void test_uprobe_race(void)
> > +{
> > +       int err, i, nr_threads;
> > +       pthread_t *threads;
> > +
> > +       nr_threads = libbpf_num_possible_cpus();
> > +       if (!ASSERT_GT(nr_threads, 0, "libbpf_num_possible_cpus"))
> > +               return;
> > +       nr_threads = max(2, nr_threads);
> > +
> > +       threads = malloc(sizeof(*threads) * nr_threads);
> 
> leaking this? maybe just use `pthread_t thread[nr_threads];`? or alloca()?

ugh.. will fix

> 
> > +       if (!ASSERT_OK_PTR(threads, "malloc"))
> > +               return;
> > +
> > +       for (i = 0; i < nr_threads; i++) {
> > +               err = pthread_create(&threads[i], NULL, i % 2 ? 
> > worker_trigger : worker_attach,
> > +                                    NULL);
> > +               if (!ASSERT_OK(err, "pthread_create"))
> > +                       goto cleanup;
> > +       }
> > +
> > +       sleep(4);
> 
> 4 seconds... can we make it much shorter and allow to define the
> actual runtime with envvar? So for thorough testing you'll define
> something multi-second, but once things land and settle we can run it
> for 100ms at most and not slow down CI significantly? All these slow
> tests do add up :(

ok, makes sense

thanks,
jirka


Reply via email to