Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BPF.ring_buffer_poll(timeout=T) documentation ambigious #5033

Open
AITleo opened this issue Jun 18, 2024 · 2 comments
Open

BPF.ring_buffer_poll(timeout=T) documentation ambigious #5033

AITleo opened this issue Jun 18, 2024 · 2 comments

Comments

@AITleo
Copy link

AITleo commented Jun 18, 2024

The documentation about the timeout for BPF.ring_buffer_poll(timeout=T) is unclear.
At least for me.

It states:

The timeout parameter is optional and measured in milliseconds. In its absence, polling continues until there is no more data or the callback returns a negative value.

From reading this I get an understanding, that if there is no timeout specified and no data available in the ringbuffer (yet), the function would not block but return immediately.

My experiments on the other hand show that it does block indefinitely and waits for data.

For my use case supplying a timeout fixes the problem,
but may I suggest to be more precise in the documentation?

I am talking about this line here.

@yonghong-song
Copy link
Collaborator

My experiments on the other hand show that it does block indefinitely and waits for data.

Could you give more specifics on blocking indefinitely?

@AITleo
Copy link
Author

AITleo commented Jun 25, 2024

Indefinitely is of course an overstatement, but when running the python program with debugger it shows that it hangs at this call.
I of course only waited a few seconds before killing my program,
but how I interpret the documentation is that without timeout it would either read from the buffer and return or if it is empty just return and never wait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants