-
Notifications
You must be signed in to change notification settings - Fork 14
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
Immutable connection and limiting outgoing messages on buffer #11
Conversation
@cathay4t Do you have any thoughts about this? |
@koalo Could you please take a look? |
I do not quite understand if you mean the second issue is triggered by fixing the first one or if this is two completely independent issues (in which case please split it up into two pull requests). |
@koalo Could you please take another look? |
@cathay4t any thoughts? |
@koalo Any update on this? |
I have reproduced the same issue with Connection::poll_send_messages(), and pretty much came up with the same solution independently before seeing this report. If the socket is Pending, it will keep accumulating a larger and larger message buffer, and when the socket becomes Ready again, it will attempt to send one gigantic message to the kernel. In addition to the reporter's description of the response message being too large, the send to kernel message can also be too big. Below is strace output of the sendto() message to the kernel failing with
|
@najaco I don't know why you keep polling me since I am not a maintainer of this project and I am still of the opinion that should should be split up into two pull requests or at least two commits (an 'and' in the title is very often an indication to split up the commit...). |
@koalo I kept polling you because you were the only one responding originally. I am not getting any responses from the original maintainers so I am not exactly sure who I am supposed to ask, but I apologize for pestering. |
Just split it up into two commits in the same pull request, remove the unnecessary merge commit and then it should be clean to merge from my point of view (even if I am not able to do so...). |
510d8e5
to
c3915e8
Compare
@koalo Done |
Great, you can have my |
Signed-off-by: Gris Ge <fge@redhat.com>
2dd0862
to
0a84bcd
Compare
I have append new patch to fix the test failures. Since this is big fundamental changes, please allow me to test this patch in rtnetlink for 4 weeks before tagging new release. |
I have manually tested this patch in my projects, works well. This patch will be contains in new 0.11.3 release: #21 |
Currently in netlink-proto's
ConnectionHandle
the functionsrequest
andnotify
require that the caller bemut
, despite there being no calls that require it's only member (theUnboundedSender
) to be&mut
.By forcing mutability, it prevents clients from being able to pass the connection handle into futures, which would be ideal for scheduling asynchronously.
After fixing this, I noticed the following issue: after scheduling a significant number of requests,
Connection::poll_send_messages
would attempt to write as many messages as possible to the buffer before being sent to the netlink socket. When the whole buffer was sent, it appeared that, on the kernel side, the netlink socket would try to respond to every message on the buffer at once, and would overflow its own returning buffer.Since there was not a deterministic way of knowing how much the kernel would write to the outgoing buffer, it was safest to swap out the ability to send multiple netlink requests with the limitation to only send one at a time. With this, we can safely pass the connection handle to a significant number of futures without having to worry about the kernel returning an OS error.