[Closed] Segmentation Fault

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

[Closed] Segmentation Fault

Post by Ensayia »

The attached LOVE file is causing a segfault. It seems to only occur on Linux machines thus far, and I can't reproduce it in Windows. It also won't occur if I run the code from ZeroBrane, with or without debugging enabled.

Use the arrow keys and space, line up three or more gems to clear. It usually happens to me after 2 or 3 gem clears.

I really have no clue what's causing it.
Attachments
test.love
(5.36 KiB) Downloaded 197 times
Last edited by Ensayia on Wed Jul 02, 2014 1:03 am, edited 1 time in total.
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Segmentation Fault

Post by SneakySnake »

It seems to be a problem with LuaJIT.

I reduced the problem to this:

Code: Select all

local t = {[0] = {}, [1] = {}, [2] = {}, [3] = {}}

for i = 1, 1000 do
    for i = 3,0,-1 do
        t[i].foo = t[i - 1]
    end
end
This crashes both LÖVE and standalone LuaJIT.
Last edited by SneakySnake on Sat Jun 28, 2014 3:52 pm, edited 1 time in total.
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Segmentation Fault

Post by SneakySnake »

Double post for some awkward reason.
Last edited by SneakySnake on Sat Jun 28, 2014 3:25 pm, edited 2 times in total.
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: Segmentation Fault

Post by mickeyjm »

SneakySnake wrote:It seems to be a problem with LuaJIT.

I reduced the problem to this:

Code: Select all

local t = {[0] = {}, [1] = {}, [2] = {}, [3] = {}}

while true do
    for i = 3,0,-1 do
        t[i].foo = t[i - 1]
    end
end
This crashes both LÖVE and standalone LuaJIT.
You're creating an infinite loop. Of course it is going to crash
Your screen is very zoomed in...
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Segmentation Fault

Post by SneakySnake »

mickeyjm wrote:You're creating an infinite loop. Of course it is going to crash
An infinite loop in itself won't cause segmentation fault.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Segmentation Fault

Post by slime »

It might if it runs out of memory, or if there's a bug in the version of LuaJIT you're using (some bugs have been fixed since 2.0.3.)
Last edited by slime on Sat Jun 28, 2014 3:56 pm, edited 1 time in total.
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Segmentation Fault

Post by SneakySnake »

Okay, to avoid confusion, I changed the infinite loop to a block that repeats 1000 times.
That ought to crash it, but it is in no way enough to cause Lua to run out of memory.

On my system. it runs fine on official Lua interpreter, but crashes with LuaJIT on the 23rd iteration.
slime wrote: or if there's a bug in the version of LuaJIT you're using (some bugs have been fixed since 2.0.3.)
It also crashes with LuaJIT Git master.
I tried to bisect it, but the bug seems to exist ever since v2.0.0-beta10 (versions before that up to initial commit don't build).
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: Segmentation Fault

Post by Xgoff »

SneakySnake wrote:Okay, to avoid confusion, I changed the infinite loop to a block that repeats 1000 times.
That ought to crash it, but it is in no way enough to cause Lua to run out of memory.

On my system. it runs fine on official Lua interpreter, but crashes with LuaJIT on the 23rd iteration.
slime wrote: or if there's a bug in the version of LuaJIT you're using (some bugs have been fixed since 2.0.3.)
It also crashes with LuaJIT Git master.
I tried to bisect it, but the bug seems to exist ever since v2.0.0-beta10 (versions before that up to initial commit don't build).
yes, crashes for me in both 2.0 and 2.1, but not stock lua

i would definitely report this to mike with your test case
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Segmentation Fault

Post by slime »

Yeah definitely, once you report a bug with a test case he usually fixes it very quickly.

You can also try calling jit.off() before the code to see if it only happens when the code is JIT-compiled.
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: Segmentation Fault

Post by SneakySnake »

slime wrote:Yeah definitely, once you report a bug with a test case he usually fixes it very quickly.

You can also try calling jit.off() before the code to see if it only happens when the code is JIT-compiled.
Indeed, it doesn't crash with jit.off().
I reported it to the LuaJIT mailing list.

(why it doesn't have a bug tracker baffles me)
Post Reply

Who is online

Users browsing this forum: No registered users and 152 guests