> I think I might have found an error in my library's heap allocator > which can result in duplicate references to copies of the same data > header, which are supposed to be different headers. This could explain > some of my problems if the above usage is correct. I will continue > investigating this possibility. One thing gives me doubt. My code > includes frequent checks of all refcounts, so if it was accessing > something with a refcount of 0 then it should detect that, and so far > it has not.
I have confirmed that this was the cause. Somehow the zero refcount was not detected in my periodic checks. Everything seems to work ok now. In summary, here is what was happening. The heap allocator I was using inside of my library had a concurrency bug where in rare cases it would allocate the same buffer to multiple concurrent threads. This led to two indirect references to the same mbuf, and the false appearance that the same mbuf had been returned twice by the DPDK allocator while still in use. Concurrency is hard. Thank you for your patient help Dmitry. -Alan