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

ngx-sample-lua-bt collects fragments of /lua/5.1/json/encode/object.lua #19

Open
zharan opened this issue Oct 28, 2014 · 1 comment
Open

Comments

@zharan
Copy link

zharan commented Oct 28, 2014

Hi,

After running the following command:

sudo ./ngx-sample-lua-bt -p 25192 --lua51 -t 30 > tmp12.bt

I noticed fragments of code from /usr/local/share/lua/5.1/json/encode/object.lua in tmp12.bt:

<fragment begin>
        29
@/usr/local/share/lua/5.1/json/encode.lua:84
[tail]
            return function(composite, ret, encode, state)
            local first = true
    for k, v in pairs(composite) do
            local ti = type(k)
            assert(ti == 'string' or ti == 'number' or ti == 'boolean', "Invalid object index type: " .. ti)
            local name = encode(tostring(k), state, true)
            if first then
                    first = false
            else
                    name = ',' .. name
            end
                    ret[#ret + 1] = (name .. ':')

            local val = encode(v, state)
            val = val or ''
            if val then
                            ret[#ret + 1] = (val)

            end
    end
                    end
    :1
@/usr/local/share/lua/5.1/json/encode/output.lua:31
<fragment end>

As a result I get malformed svg file after converting tmp12.bt into a flame-graph. What problem could this be?

@agentzh
Copy link
Member

agentzh commented Oct 28, 2014

@zharan This happens when the chunk name is the source itself (like loaded by the Lua builtin loadstring without specifying a chunk name). Better explicitly provide a chunk name to the loadstring builtin. Another option is to make sample-lua-bt remove newlines and other special chars from this long chunk name.

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

2 participants