-
Notifications
You must be signed in to change notification settings - Fork 121
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
Mesh packet pool overflow due to duplicate packets. #169
Comments
You cannot just purge duplicate packets; the reference counting system takes care of memory management for you. If you start freeing packets on your own there will be problems with other pieces of code that still have pointers to the packet you are freeing and are still assuming they own them. What is your application code doing, exactly? I have run stress tests with a pool size of 45 and have never had any problems running out of pool space. I think it is more likely there is a packet not being freed somewhere, filling the packet pool. |
Hellol @twvd , thank you for your reply. My code sends and receives commands, only that it identifies every single node using MAC address. I believe you are most likely right in assuming I can't just release packet pools on my own. So my questions:
If you want I can attach my files but at this point I'm not sure whether that's a good idea, because if the code itself prevents the duplication then clearly my modification of the original code must have caused the problem, if the original code does not have such a function at all then clearly I should look into it before posting my code. |
Hi there, Like Thomas, we run stress tests for this problem regularly (since it's such a likely bug), and haven't really found any problems in the current version of the mesh, as long as the packet pool is larger than or equal to default in rbc_mesh.h:L102. The handle storage will keep received packets around as long as they represent the most recent version of their handle. The handle storage will hold a single reference for each of these packets. You can check whether you have any packets that represent the same handle, but different versions. If you do, you may have a memory leak somewhere. Note that there will be unprocessed packets in the queues, that will have the same handle as some of the others. Have you done any modifications to the mesh code? Does your application ALWAYS free an event-packet after handling it? Is your data and handle caches larger than the set of used handles in your mesh (they don't have to be, but this has been a cause of this error in development before)? Do not release packets on your own. This will cause some packets to be referenced by the handle storage after they've been freed, and will trigger odd behavior. If you have to do this, you should call |
Hello, please refer to this issue: (1)
#167
and this issue: (2)
#79
for more information.
I'm having the same issue as (2), and (1) was my previous issue, the mesh_packet pool easily run out of memory, because it works on a "allocate a slot in packet pool first, question the content of the packet never!" basis, I'm currently runing a pool with the size of 43, and I have tried to increased it to 300 but to no avail, other than prolonging the time.
I have tried to purge the duplicate members of the packet pool by implementing a simple search and replace mechanism, please refer to the following code:
bool mesh_packet_acquire(mesh_packet_t** pp_packet)
{
uint32_t was_masked;
}
But it doesn't work, and here is the call stack window information:
[http://imgur.com/a/nzbwf]
Clearly things went wrong when transmitting all instances.
So my question:
2.how do I prevent the overflowing of packet pool? This is getting way too consuming.
Thanks for anyone's help!
The text was updated successfully, but these errors were encountered: