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

Unanchored FFI objects in lpm4_dxr #1238

Open
alexandergall opened this issue Sep 27, 2017 · 3 comments
Open

Unanchored FFI objects in lpm4_dxr #1238

alexandergall opened this issue Sep 27, 2017 · 3 comments

Comments

@alexandergall
Copy link
Contributor

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 in table:build()

local lpm = require("lib.lpm.lpm4_dxr").LPM4_dxr
require("lib.protocol.ipv4")

local table = lpm:new()
for i = 1, 10 do
   local pfx = "10.0."..i..".0/24"
   table:add_string(pfx, i)
end

collectgarbage()
table:build()

It behaves correctly if either collectgarbage() or require("lib.protocol.ipv4") is removed. The weird part is that this only happens when I require something from lib.protocol. Nevertheless, I believe that this just happens to create a particular state on the heap that causes an object used by lpm4_dxr to be collected prematurely due to a lack of anchoring.

@alexandergall
Copy link
Contributor Author

@petebristow can you have a look at this, please?

@raj2569
Copy link

raj2569 commented Sep 28, 2017

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"

@petebristow
Copy link
Contributor

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.

eugeneia added a commit to eugeneia/snabb that referenced this issue Feb 12, 2018
Works around snabbco#1238 (lib.lpm requires a default entry "0.0.0.0/0") by
adding a default entry that maps to nil.
eugeneia added a commit to eugeneia/snabb that referenced this issue Mar 9, 2018
Works around snabbco#1238 (lib.lpm requires a default entry "0.0.0.0/0") by
adding a default entry that maps to nil.
eugeneia pushed a commit to eugeneia/snabb that referenced this issue Dec 20, 2019
Disable vmprofile on lwAFTR by default
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

3 participants