small script to reproduce bogus trace stitch errors at line 0 with coroutines in latest 2.1

  • From: Elias Hogstvedt <eliashogstvedt@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 28 Apr 2015 15:38:48 +0200

--require("jit.opt").start("minstitch=99999999") -- uncomment for errors

local queue = {}

for i = 1, 10000 do
queue[i] = assert(coroutine.create(assert(loadstring(([[
local out = 0
for i = 1, 10000000 do
out = out + %s
coroutine.yield()
end
--return out
]]):format(math.random())))))
end

while true do
for i,co in ipairs(queue) do
local ok, err = coroutine.resume(co)
if not ok then
print(i, co, ok, err)
table.remove(queue, i)
break
end
end
end

output:

4275 thread: 0x2e88e760 false [string "..."]:0: attempt to call a
number value
878 thread: 0x2e507a00 false [string "..."]:0: attempt to call a
number value
3276 thread: 0x2e748eb8 false [string "..."]:0: attempt to index
a nil value
9228 thread: 0x2ecaaac8 false [string "..."]:0: attempt to call a
number value
9197 thread: 0x2e6d4af0 false [string "..."]:0: attempt to call a
number value
156 thread: 0x2e43fc18 false [string "..."]:0: attempt to call a
number value
8056 thread: 0x2ec3a6a0 false [string "..."]:0: attempt to index
a nil value
6076 thread: 0x2e888fa0 false [string "..."]:0: attempt to call a
number value
6080 thread: 0x2e88eb70 false [string "..."]:0: attempt to index
a nil value
8763 thread: 0x2ed0bac8 false [string "..."]:0: attempt to index
a nil value
3076 thread: 0x2e7098b8 false [string "..."]:0: attempt to index
a nil value
3292 thread: 0x2e74ef00 false [string "..."]:0: attempt to index
a nil value
7360 thread: 0x2eb60460 false [string "..."]:0: attempt to index
a nil value
9850 thread: 0x2e7f2598 false [string "..."]:0: attempt to call a
number value
4012 thread: 0x2e8347d8 false [string "..."]:0: attempt to index
a nil value
7366 thread: 0x2eb62e68 false [string "..."]:0: attempt to index
a nil value
2942 thread: 0x2e605eb8 false [string "..."]:0: attempt to index
a nil value
9331 thread: 0x2eb5caf0 false [string "..."]:0: attempt to index
a nil value
4172 thread: 0x2e86fe68 false [string "..."]:0: attempt to call a
number value
1086 thread: 0x2e51acb0 false [string "..."]:0: attempt to call a
number value
4283 thread: 0x2e894310 false [string "..."]:0: attempt to index
a nil value
4710 thread: 0x2e6da5e0 false [string "..."]:0: attempt to call a
number value
5116 thread: 0x2e6ff780 false [string "..."]:0: attempt to call a
number value
7623 thread: 0x2ebb6140 false [string "..."]:0: attempt to call a
number value
9739 thread: 0x2e783d98 false [string "..."]:0: attempt to call a
number value
1602 thread: 0x2e5b1948 false [string "..."]:0: attempt to index
a nil value
............ etc


the order of these errors are consistent (at least on my computer until)
you change the code around (like appending "+ 2" to out in the loop)

Other related posts: