rvirding/luerl — Issue #3: nil for table record in set_table_key/4
Author: hdiedrich
Created: 2012-02-26 01:39:26+00:00
State: open

I think I manage to get a nil instead of a {table,..} tuple in set_table_key/4

To reproduce the error, this is the best I can offer right now:

https://github.com/Eonblast/luerl/commit/f1bb4530e200f6f4476ae8cbb7f33b87f10b025a

This is tagged `issue3` in the branch `henning`.

If you check it out, you can run `make bench` to produce the error.

I tried to narrow in the error in the Lua source code, but so far no luck. Maybe this already helps.

What the above tag is, it's an old, simpler version of Luabench ( ) -- the least complicated and shortest. I had tried making Luabench run and (no matter the version) this error is what I ran into.

To help me find it, I slightly changed set_table_key (see above link, bottom of page) and added a function clause that prints an error right away, telling me what came in for the table record:

set_table_key(Key, Val, T, #luerl{}=St) ->
error({luerl_error, {"not a table record:", T, {Key, Val, St}}}).

The rest of that tag is exactly your new master of today.

Before that change, this is what I get:

{"init terminating in do_boot",{function_clause,[{luerl_eval,set_table_key,[<<4 bytes>>,<<7 bytes>>,nil,{luerl,[{0,{[{<<2 bytes>>,{table,0}},{<<8 bytes>>,<<7 bytes>>},{<<6 bytes>>,{function,#Fun}},{<<14 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<12 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<8 bytes>>,{function,#Fun}},{<<4 bytes>>,{table,1}},{<<4 bytes>>,{function,#Fun}},{<<2 bytes>>,{table,2}},{<<5 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<8 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<12 bytes>>,{function,#Fun}},{<<6 bytes>>,{table,3}},{<<5 bytes>>,{table,4}},{<<8 bytes>>,{function,#Fun}},{<<8 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}}],nil}},{1,{[{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<2 bytes>>,3.141593e+00},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}}],nil}},{2,{[{<<8 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}}],nil}},{3,{[{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<7 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}}],nil}},{4,{[{<<6 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}}],nil}},{5,{[],nil}}],[],6,[{table,5},{table,0}],false,#Ref<0.0.0.29>}],[{file,"src/luerl_eval.erl"},{line,126}]},{luerl_eval,assign_loop,3,[{file,"src/luerl_eval.erl"},{line,346}]},{luerl_eval,stats,2,[{file,"src/luerl_eval.erl"},{line,299}]},{luerl_eval,'-funchunk/2-fun-0-',2,[{file,"src/luerl_eval.erl"},{line,253}]},{luerl_eval,'-function_block/2-fun-0-',2,[{file,"src/luerl_eval.erl"},{line,630}]},{luerl_eval,with_block,2,[{file,"src/luerl_eval.erl"},{line,288}]},{luerl_eval,funchunk,2,[{file,"src/luerl_eval.erl"},{line,253}]},{bench,run,0,[{file,"bench.erl"},{line,14}]}]}}

After that change, this is what I get:

"init terminating in do_boot",{{luerl_error,{"not a table record:",nil,{<<4 bytes>>,<<7 bytes>>,{luerl,[{0,{[{<<2 bytes>>,{table,0}},{<<8 bytes>>,<<7 bytes>>},{<<6 bytes>>,{function,#Fun}},{<<14 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<12 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<8 bytes>>,{function,#Fun}},{<<4 bytes>>,{table,1}},{<<4 bytes>>,{function,#Fun}},{<<2 bytes>>,{table,2}},{<<5 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<8 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<12 bytes>>,{function,#Fun}},{<<6 bytes>>,{table,3}},{<<5 bytes>>,{table,4}},{<<8 bytes>>,{function,#Fun}},{<<8 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}}],nil}},{1,{[{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<2 bytes>>,3.141593e+00},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}}],nil}},{2,{[{<<8 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}}],nil}},{3,{[{<<4 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<7 bytes>>,{function,#Fun}},{<<3 bytes>>,{function,#Fun}},{<<5 bytes>>,{function,#Fun}}],nil}},{4,{[{<<6 bytes>>,{function,#Fun}},{<<4 bytes>>,{function,#Fun}},{<<6 bytes>>,{function,#Fun}}],nil}},{5,{[],nil}}],[],6,[{table,5},{table,0}],false,#Ref<0.0.0.29>}}}},[{luerl_eval,set_table_key,4,[{file,"src/luerl_eval.erl"},{line,148}]},{luerl_eval,assign_loop,3,[{file,"src/luerl_eval.erl"},{line,349}]},{luerl_eval,stats,2,[{file,"src/luerl_eval.erl"},{line,302}]},{luerl_eval,'-funchunk/2-fun-0-',2,[{file,"src/luerl_eval.erl"},{line,256}]},{luerl_eval,'-function_block/2-fun-0-',2,[{file,"src/luerl_eval.erl"},{line,633}]},{luerl_eval,with_block,2,[{file,"src/luerl_eval.erl"},{line,291}]},{luerl_eval,funchunk,2,[{file,"src/luerl_eval.erl"},{line,256}]},{bench,run,0,[{file,"bench.erl"},{line,14}]}]}}