Open alexandergall opened 7 years ago
@petebristow can you have a look at this, please?
Slightly different error here:
module(..., package.seeall)
local lib = require("core.lib")
local logger = lib.logger_new({ rate = 32, module = 'lpm'});
local lpm4 = require("lib.lpm.lpm4_dxr").LPM4_dxr
Route = {}
function Route:new (conf)
local o = {lpm_hash = lpm4:new()}
logger:log("Adding entries to lpm")
o.lpm_hash:add_string("16.0.0.0/24", 1)
o.lpm_hash:add_string("16.0.0.1/24", 2)
o.lpm_hash:add_string("48.0.0.1/24", 3)
logger:log("Building lpm")
o.lpm_hash:build()
logger:log("Added entries to lpm")
return setmetatable(o, {__index = self})
end
function Route:push()
end
Its stuck after printing "Added entries to lpm"
Apologies for my tardiness. You've hit an undocumented feature. (It's documented in my internal version of LPM but I'm not sure that counts :S) Every LPM instance requires a 0.0.0.0/0 entry. If you don't have a a default route then you need to install an explicit "I don't know" value.
I ran across an issue with
lib.lpm.lpm4_dxr
that seems to be caused by an unanchroed FFI object. The only way I found to reproduce it is a bit weird, though. For me, the following code is stuck intable:build()
It behaves correctly if either
collectgarbage()
orrequire("lib.protocol.ipv4")
is removed. The weird part is that this only happens when Irequire
something fromlib.protocol
. Nevertheless, I believe that this just happens to create a particular state on the heap that causes an object used bylpm4_dxr
to be collected prematurely due to a lack of anchoring.