Hi, Sorry for the late response, setting the rlimit worked. Hmm, that makes sense. Thank you for the reply! On Oct 1 2024, at 9:13 pm, Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > On Thu, Sep 19, 2024 at 5:13 PM Sebastião Amaro > <sebassamaro97@xxxxxxxxx> wrote: >> >> Hi everyone! >> I have two questions related to user function probes: >> Firstly, I am trying to have a process attach more than 1024 uprobes, >> however, I am getting the error: "failed to create BPF link for >> perf_event FD 1023: -24 (Too many open files)" even after changing >> ulimit -n to 4096 github issue[1]. > > See [0], it might be that `ulimit -n` isn't really changing the limit > for your process or something. To be 100% sure I'd do > setrlimit(RLIMIT_NOFILE, ...) from inside the process to verify. > > [0] https://unix.stackexchange.com/questions/8945/how-can-i-increase-open-files-limit-for-all-processes > >> Secondly, I am running some tests with uprobe and uprobe_ret in multiple >> functions in the redis binary, but I am noticing that when counting the >> times the uprobes and uprobes_ret are called, in the end they do not >> match 1 to 1. Either individually (a uprobe/uprobe_ret in the same >> function), or the total sum. Is this a predictable behaviour? >> I am tracing several functions in such as [2]. > > Attachment is not atomic, so you might get some uprobes attached > before corresponding uretprobe is attached, and vice versa. So counts > might not match 1:1 during attachment and detachment. > >> >> [1]https://github.com/libbpf/libbpf-rs/issues/942 >> [2]https://github.com/redis/redis/blob/3a3cacfefabf8ced79b448169319ce49cca2bfb7/src/rdb.c#L1782 >> >> Thank you, and Best Regards, >> Sebastião Amaro >> >