Closed agentzh closed 6 months ago
BTW, I only registered a uprobe in this example.
And when hot looping happens, there is no target processes with the bpftime agent library started yet.
I'm not sure if it makes any difference after the target processes start (I haven't tested this case).
OK, I found that after the target process with the bpftime agent started, and also there's a fatal error like this:
[2024-01-27 23:05:03.707] [info] [agent.cpp:66] Entering bpftime agent
[2024-01-27 23:05:03.708] [info] [bpftime_shm_internal.cpp:618] Global shm constructed. shm_open_type 1 for bpftime_maps_shm
[2024-01-27 23:05:03.708] [info] [agent.cpp:81] Initializing agent..
[2024-01-27 23:05:03][error][644325] Failed to load insn: invalid call immediate at PC 17
[2024-01-27 23:05:03][error][644325] Failed to initialize attach context
[2024-01-27 23:05:03.712] [info] [agent.cpp:66] Entering bpftime agent
[2024-01-27 23:05:03.712] [info] [bpftime_shm_internal.cpp:618] Global shm constructed. shm_open_type 1 for bpftime_maps_shm
[2024-01-27 23:05:03.712] [info] [agent.cpp:81] Initializing agent..
[2024-01-27 23:05:03][error][644325] Failed to load insn: invalid call immediate at PC 17
[2024-01-27 23:05:03][error][644325] Failed to initialize attach context
INFO [644325]: Global shm destructed
The server process then enters the epoll wait hot loop forever also, just like the case above.
OK, it seems like this is because bpftime's epoll emulation fails to implement the -1 timeout argument correctly. In this case, it just returns immediately without checking any events. And this is why the ringbuf is never consumed by the server or tracer.
/assign
I've found that bpftime's epoll_wait emulation might hot loop when no events arrive. The
top
shows the tracer process (or the bpftime server process's child process) is almost always using 100% CPU:perf top
shows the hottest functions are all inlibbpftime-syscall-server.so
:Can we add some sleep in between? This is too wasteful when the events do not arrive immediately.