Page 1 of 1

Crash drawing large number of circles

Posted: Mon Jun 21, 2021 4:11 am
by scoobyff666
Before anything else, I believe this problem may be the same reported by this person here: https://love2d.org/forums/viewtopic.php?f=4&t=91182, but there was not enough detail for me to be sure.

I'm pasting below both the code and the logs. I'm using love 11.3 on arch linux.

In this program I provided, you can pass a number as command line argument to set the number of circles drawn to the screen each frame. The problem is that when this number is high enough (in this minimal test it was somewhere around 650, but it was a different number in my actual program, where I found the problem), the program crashes with 'Aborted (core dumped)'. I would like to know if others can reproduce this and is someone has any idea of what is the cause, before reporting this as a bug.

Code: Select all

-- main.lua
local objects = 1000
local screen_width, screen_height = 500, 500

function love.load(arg)
  if arg[1] then objects = tonumber(arg[1]) end
end

function love.draw()
  love.graphics.setColor(0.6, 0.6, 0.6, 1)
  for _ = 1, objects do
    love.graphics.circle(
      "line",
      math.random() * screen_width,
      math.random() * screen_height,
      math.random() * 20 + 4
    )
  end
end

function love.resize(w, h)
  screen_width = w
  screen_height = h
end

Code: Select all

Process 16610 (love) of user 1000 dumped core.

Stack trace of thread 16610:
#0  0x00007f149d5b0d22 raise (libc.so.6 + 0x3cd22)
#1  0x00007f149d59a862 abort (libc.so.6 + 0x26862)
#2  0x00007f149a3cc4a4 n/a (iris_dri.so + 0x1a14a4)
#3  0x00007f149aee21a4 n/a (iris_dri.so + 0xcb71a4)
#4  0x00007f149a46336b n/a (iris_dri.so + 0x23836b)
#5  0x00007f149a3ed921 n/a (iris_dri.so + 0x1c2921)
#6  0x00007f149bdd2edc n/a (libGLX_mesa.so.0 + 0x50edc)
#7  0x00007f149d4d06a3 n/a (libSDL2-2.0.so.0 + 0xf16a3)
#8  0x00007f149d973062 _ZN4love8graphics6opengl8Graphics7presentEPv (liblove-11.3.so + 0x1c2062)
#9  0x00007f149d98eb88 _ZN4love8graphics9w_presentEP9lua_State (liblove-11.3.so + 0x1ddb88)
#10 0x00007f149d748936 n/a (libluajit-5.1.so.2 + 0x8936)
#11 0x000055c72cbc928d n/a (love + 0x128d)
#12 0x00007f149d59bb25 __libc_start_main (libc.so.6 + 0x27b25)
#13 0x000055c72cbc94de n/a (love + 0x14de)

Stack trace of thread 16611:
#0  0x00007f149cf6b8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
#1  0x00007f149cf65270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270)
#2  0x00007f149a3f159c n/a (iris_dri.so + 0x1c659c)
#3  0x00007f149a3eb618 n/a (iris_dri.so + 0x1c0618)
#4  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#5  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16614:
#0  0x00007f149cf6b8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
#1  0x00007f149cf65270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270)
#2  0x00007f149a3f159c n/a (iris_dri.so + 0x1c659c)
#3  0x00007f149a3eb618 n/a (iris_dri.so + 0x1c0618)
#4  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#5  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16653:
#0  0x00007f149cf6b8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
#1  0x00007f149cf65270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270)
#2  0x00007f149a3f159c n/a (iris_dri.so + 0x1c659c)
#3  0x00007f149a3eb618 n/a (iris_dri.so + 0x1c0618)
#4  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#5  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16624:
#0  0x00007f149d667b2f __poll (libc.so.6 + 0xf3b2f)
#1  0x00007f149d230407 n/a (libopenal.so.1 + 0x80407)
#2  0x00007f14901e99a9 pa_mainloop_poll (libpulse.so.0 + 0x1c9a9)
#3  0x00007f14901f4281 pa_mainloop_iterate (libpulse.so.0 + 0x27281)
#4  0x00007f14901f4331 pa_mainloop_run (libpulse.so.0 + 0x27331)
#5  0x00007f149d23196e n/a (libopenal.so.1 + 0x8196e)
#6  0x00007f149ce133c4 execute_native_thread_routine (libstdc++.so.6 + 0xd33c4)
#7  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#8  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16635:
#0  0x00007f149cf6b8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
#1  0x00007f149cf65270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270)
#2  0x00007f149d4ff43f n/a (libSDL2-2.0.so.0 + 0x12043f)
#3  0x00007f149da04726 _ZN4love6thread3sdl11Conditional4waitEPNS0_5MutexEi (liblove-11.3.so + 0x253726)
#4  0x00007f149da0884b _ZN4love5video6theora6Worker14threadFunctionEv (liblove-11.3.so + 0x25784b)
#5  0x00007f149da04550 _ZN4love6thread3sdl6Thread13thread_runnerEPv (liblove-11.3.so + 0x253550)
#6  0x00007f149d45f8d1 n/a (libSDL2-2.0.so.0 + 0x808d1)
#7  0x00007f149d4fecaa n/a (libSDL2-2.0.so.0 + 0x11fcaa)
#8  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#9  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16633:
#0  0x00007f149cf6b8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
#1  0x00007f149cf67ae8 __new_sem_wait_slow64.constprop.0 (libpthread.so.0 + 0x11ae8)
#2  0x00007f149d246234 n/a (libopenal.so.1 + 0x96234)
#3  0x00007f149d1dca85 n/a (libopenal.so.1 + 0x2ca85)
#4  0x00007f149ce133c4 execute_native_thread_routine (libstdc++.so.6 + 0xd33c4)
#5  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#6  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16613:
#0  0x00007f149cf6b8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
#1  0x00007f149cf65270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270)
#2  0x00007f149a3f159c n/a (iris_dri.so + 0x1c659c)
#3  0x00007f149a3eb618 n/a (iris_dri.so + 0x1c0618)
#4  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#5  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16634:
#0  0x00007f149d63aa95 clock_nanosleep@@GLIBC_2.17 (libc.so.6 + 0xc6a95)
#1  0x00007f149d63fc77 __nanosleep (libc.so.6 + 0xcbc77)
#2  0x00007f149d5018ac n/a (libSDL2-2.0.so.0 + 0x1228ac)
#3  0x00007f149d928683 _ZN4love5audio6openal5Audio10PoolThread14threadFunctionEv (liblove-11.3.so + 0x177683)
#4  0x00007f149da04550 _ZN4love6thread3sdl6Thread13thread_runnerEPv (liblove-11.3.so + 0x253550)
#5  0x00007f149d45f8d1 n/a (libSDL2-2.0.so.0 + 0x808d1)
#6  0x00007f149d4fecaa n/a (libSDL2-2.0.so.0 + 0x11fcaa)
#7  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#8  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16622:
#0  0x00007f149d667b2f __poll (libc.so.6 + 0xf3b2f)
#1  0x00007f149d230407 n/a (libopenal.so.1 + 0x80407)
#2  0x00007f14901e99a9 pa_mainloop_poll (libpulse.so.0 + 0x1c9a9)
#3  0x00007f14901f4281 pa_mainloop_iterate (libpulse.so.0 + 0x27281)
#4  0x00007f14901f4331 pa_mainloop_run (libpulse.so.0 + 0x27331)
#5  0x00007f149d23196e n/a (libopenal.so.1 + 0x8196e)
#6  0x00007f149ce133c4 execute_native_thread_routine (libstdc++.so.6 + 0xd33c4)
#7  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#8  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Stack trace of thread 16612:
#0  0x00007f149cf6b8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
#1  0x00007f149cf65270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270)
#2  0x00007f149a3f159c n/a (iris_dri.so + 0x1c659c)
#3  0x00007f149a3eb618 n/a (iris_dri.so + 0x1c0618)
#4  0x00007f149cf5f259 start_thread (libpthread.so.0 + 0x9259)
#5  0x00007f149d6725e3 __clone (libc.so.6 + 0xfe5e3)

Re: Crash drawing large number of circles

Posted: Mon Jun 21, 2021 7:51 am
by GVovkiv
Well, even 3000 objects works fine for me

Re: Crash drawing large number of circles

Posted: Mon Jun 21, 2021 11:29 am
by pgimeno
Even 40,000.

Code: Select all

Stack trace of thread 16610:
#0  0x00007f149d5b0d22 raise (libc.so.6 + 0x3cd22)
#1  0x00007f149d59a862 abort (libc.so.6 + 0x26862)
#2  0x00007f149a3cc4a4 n/a (iris_dri.so + 0x1a14a4)
#3  0x00007f149aee21a4 n/a (iris_dri.so + 0xcb71a4)
#4  0x00007f149a46336b n/a (iris_dri.so + 0x23836b)
#5  0x00007f149a3ed921 n/a (iris_dri.so + 0x1c2921)
#6  0x00007f149bdd2edc n/a (libGLX_mesa.so.0 + 0x50edc)
#7  0x00007f149d4d06a3 n/a (libSDL2-2.0.so.0 + 0xf16a3)
#8  0x00007f149d973062 _ZN4love8graphics6opengl8Graphics7presentEPv (liblove-11.3.so + 0x1c2062)
#9  0x00007f149d98eb88 _ZN4love8graphics9w_presentEP9lua_State (liblove-11.3.so + 0x1ddb88)
Sounds like a graphics driver issue on call to love.graphics.present(). iris_dri suggests you're using an Intel graphics card, and it's that driver that is calling abort(). Try to find updated drivers. Also see if you can find the settings and if there's anything in them about memory capacity or the like.

Re: Crash drawing large number of circles

Posted: Mon Jun 21, 2021 4:30 pm
by slime
Unfortunately there's a bug in love's smooth line code in 11.3. You could switch to rough lines (love.graphics.setLineStyle("rough")) or draw images that look like circles, or update to the latest 11.4 code from github: https://github.com/love2d/love

Re: Crash drawing large number of circles

Posted: Tue Jun 22, 2021 3:19 am
by scoobyff666
As pgimeno said, it is probably a graphics driver issue. I tried running the same code with my nvidia card and it worked regardless of the number of circles.

About the bug in smooth line code in love 11.3, I think it may not be related, because setting the line style to rough didn't solve the issue. It did, however, raise the number of circles needed to cause the crash considerably.

Re: Crash drawing large number of circles

Posted: Tue Jun 22, 2021 6:14 am
by AuahDark
I believe this issue has been fixed in 11.4. I'd love if you can try love-git AUR https://aur.archlinux.org/packages/love-git and report back.

Re: Crash drawing large number of circles

Posted: Wed Jun 23, 2021 12:28 am
by scoobyff666
You're correct. I have tried it with love-git from the AUR and there is no error. Thanks!