Opened 3 years ago

Closed 3 years ago

#16840 closed bug (duplicate)

Some OpenGL applications like GLInfo crash on exit under Mesa 21

Reported by: kallisti5 Owned by: kallisti5
Priority: normal Milestone: Unscheduled
Component: Kits/OpenGL Kit Version: R1/beta2
Keywords: Cc:
Blocked By: #14535 Blocking:
Platform: All

Description

When testing the new Mesa 21 recipe, some applications like GLInfo crash on exit due to a hoard / heap error.

Likely related to the recent OpenGL dispatch work.

GLInfo: ../haiku-git/src/system/libroot/posix/malloc_hoard2/superblock.h:194:void BPrivate::superblock::putBlock(BPrivate::block*): getNumAvailable() < getNumBlocks()

Attachments (3)

screenshot7.png (376.1 KB ) - added by kallisti5 3 years ago.
qemu6.png (167.4 KB ) - added by kallisti5 3 years ago.
qemu 6, OpenGL crash
qemu6.2.png (167.4 KB ) - added by kallisti5 3 years ago.
qemu 6, OpenGL crash

Download all attachments as: .zip

Change History (16)

by kallisti5, 3 years ago

Attachment: screenshot7.png added

comment:1 by kallisti5, 3 years ago

$ LD_PRELOAD=/boot/system/lib/libroot_debug.so MALLOC_DEBUG=g GLInfo 
OpenGL load add-on: /boot/system/add-ons/opengl/Software Pipe
OpenGL add-on registered: /boot/system/add-ons/opengl/Software Pipe
GalliumContext: CreateDisplay: Using llvmpipe (LLVM 9.0.1, 256 bits) driver.
Mesa: User error: GL_INVALID_OPERATION in glGetConvolutionParameteriv
flags:
allocation size: 72
allocation base: 0x927f27cfb0
alignment: 16
allocating thread: 2472
freeing thread: 2520
Kill Thread

comment:2 by kallisti5, 3 years ago

Here we go...

alloc stack trace (15):
    <libstdc++.so.6> _Znwm + 0x20
    <libbe.so> _ZN10BScrollBarC1E5BRectPKcP5BViewff11orientation + 0xb3
    <_APP_> _ZN15BColumnListView5_InitEv + 0x25d
    <_APP_> _ZN15BColumnListViewC1EPKcj12border_styleb + 0xba
    <_APP_> _ZN16CapabilitiesViewC2Ev + 0x80
    <_APP_> _ZN10OpenGLViewC1Ev + 0x13e
    <_APP_> _ZN12OpenGLWindowC2Ev + 0xb5
    <_APP_> _ZN9OpenGLApp10ReadyToRunEv + 0x1f
    <libbe.so> _ZN12BApplication15DispatchMessageEP8BMessageP8BHandler + 0x424
    <libbe.so> _ZN7BLooper11task_looperEv + 0x26c
    <libbe.so> _ZN12BApplication3RunEv + 0x21
    <_APP_> main + 0x25
    <_APP_> _start + 0x3e
    0x12c49075505 (lookup failed: Invalid Argument)
    0x7fc268def260 (lookup failed: Invalid Argument)



Call (thread 3096 tried accessing address 0xdfc7457fb0 which is not allocated
(base: 0xdfc7457fb0, size: 72, alignment: 16, allocated by thread: 3046, freed by thread: 3096))

comment:3 by kallisti5, 3 years ago

More data..

> LD_PRELOAD=libroot_debug.so MALLOC_DEBUG=ges100 GLInfo
OpenGL load add-on: /boot/system/add-ons/opengl/Software Pipe
OpenGL add-on registered: /boot/system/add-ons/opengl/Software Pipe
GalliumContext: CreateDisplay: Using llvmpipe (LLVM 9.0.1, 256 bits) driver.
Mesa: User error: GL_INVALID_OPERATION in glGetConvolutionParameteriv
flags:
allocation size: 72
allocation base: 0x52a92bbfb0
alignment: 16
allocating thread: 3347
freeing thread: 3395
---------------------------------------------------------------------------
Team                                                  Id #Threads  Gid  Uid 
/boot/system/apps/GLInfo                            3347       38    0    0 

Thread                                   Id    State Prio    UTime    KTime
GLInfo                                 3347     wait   10      148      146 
llvmpipe-0                             3351     wait   10        0        0 
llvmpipe-1                             3352     wait   10        0        0 
llvmpipe-2                             3353     wait   10        0        0 
llvmpipe-3                             3354     wait   10        0        0 
llvmpipe-4                             3355     wait   10        0        0 
llvmpipe-5                             3356     wait   10        0        0 
llvmpipe-6                             3357     wait   10        0        0 
llvmpipe-7                             3358     wait   10        0        0 
llvmpipe-8                             3359     wait   10        0        0 
llvmpipe-9                             3360     wait   10        0        0 
llvmpipe-10                            3361     wait   10        0        0 
llvmpipe-11                            3362     wait   10        0        0 
llvmpipe-12                            3363     wait   10        0        0 
llvmpipe-13                            3364     wait   10        0        0 
llvmpipe-14                            3365     wait   10        0        0 
llvmpipe-15                            3366     wait   10        0        0 
pthread func                           3367     wait   10        0        0 
pthread func                           3368     wait   10        0        0 
pthread func                           3369     wait   10        0        0 
pthread func                           3370     wait   10        0        0 
pthread func                           3371     wait   10        0        0 
pthread func                           3372     wait   10        0        0 
pthread func                           3373     wait   10        0        0 
pthread func                           3374     wait   10        0        0 
pthread func                           3375     wait   10        0        0 
pthread func                           3376     wait   10        0        0 
pthread func                           3377     wait   10        0        0 
pthread func                           3378     wait   10        0        0 
pthread func                           3379     wait   10        0        0 
pthread func                           3380     wait   10        0        0 
pthread func                           3381     wait   10        0        0 
pthread func                           3382     wait   10        0        0 
GLInfo:disk$0                          3383     wait   10        0        0 
GLInfo:disk$1                          3384     wait   10        0        0 
GLInfo:disk$2                          3385     wait   10        0        0 
GLInfo:disk$3                          3386     wait   10        0        0 
w>GL Info                              3395     wait   15        2        9 
---------------------------------------------------------------------------
Call (thread 3395 tried accessing address 0x52a92bbfb0 which is not allocated (base: 0x52a92bbfb0, size: 72, alignment: 16, allocated by thread: 3347, freed by thread: 3395))

Path:

  • The application (GLInfo 3347) allocated whatever is at 0x52a92bbfb0
  • BWindow (3347 w>GL Info) accessed 0x52a92bbfb0 at exit
  • 0x52a92bbfb0 was already freed by the window (3347 w>GL Info) already

Now.. what the hell is at 0x52a92bbfb0 :-)

comment:4 by kallisti5, 3 years ago

  • GLTeapot, Haiku3D do not crash on exit
  • GLInfo, GZDoom *do* crash on exit

comment:5 by kallisti5, 3 years ago

Some debugging info. This prevents GLInfo from crashing on exit. Nothing else really does (disable locking, deleting glView at the end of OpenGLView(), etc)

 git diff
diff --git a/src/tests/kits/opengl/glinfo/OpenGLView.cpp b/src/tests/kits/opengl/glinfo/OpenGLView.cpp
index d763792d91..81ff673711 100644
--- a/src/tests/kits/opengl/glinfo/OpenGLView.cpp
+++ b/src/tests/kits/opengl/glinfo/OpenGLView.cpp
@@ -40,7 +40,7 @@ OpenGLView::OpenGLView()
        BGLView* glView = new BGLView(BRect(0, 0, 1, 1), "gl info", B_FOLLOW_NONE, 0,
                BGL_RGB | BGL_DOUBLE);
        glView->Hide();
-       AddChild(glView);
+       //AddChild(glView);
 
        glView->LockGL();
 

comment:6 by kallisti5, 3 years ago

This also fixes the crash in GLInfo...

diff --git a/src/tests/kits/opengl/glinfo/OpenGLView.cpp b/src/tests/kits/opengl/glinfo/OpenGLView.cpp
index d763792d91..89ccd639ec 100644
--- a/src/tests/kits/opengl/glinfo/OpenGLView.cpp
+++ b/src/tests/kits/opengl/glinfo/OpenGLView.cpp
@@ -66,6 +66,7 @@ OpenGLView::OpenGLView()
                        .End();
 
        glView->UnlockGL();
+       RemoveChild(glView);
 }
 
 OpenGLView::~OpenGLView()

So.. something about the BView deconstructing with a BGLView child still "attached"

comment:7 by X512, 3 years ago

Likely problem in my HGL work. I look at it when I have time.

comment:8 by kallisti5, 3 years ago

@X512 , any progress on this one? SDL2 apps like qemu are also crashing. I have a backtrace that might help (see screenshot)

by kallisti5, 3 years ago

Attachment: qemu6.png added

qemu 6, OpenGL crash

comment:9 by X512, 3 years ago

Does it works with older libsdl2 version with my patch applied (https://github.com/haikuports/haikuports/pull/4535)?

by kallisti5, 3 years ago

Attachment: qemu6.2.png added

qemu 6, OpenGL crash

comment:10 by kallisti5, 3 years ago

@X512 SDL in addition to native GLView apps are crashing. Do you know a solution for things like GLTeapot?

comment:11 by X512, 3 years ago

in addition to native GLView apps are crashing.

Does it crash in the same place?

I am still use my builds of Mesa and libsdl2 instead of HaikuPorts and it works fine. I have not tracked yet what have been done without me with HaikuPorts patchsets, maybe something is broken there.

comment:12 by kallisti5, 3 years ago

stock upstream mesa sources on Haiku. This has been happening since merging https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8323

All the examples above are native Be applications.

comment:13 by pulkomandy, 3 years ago

Blocked By: 14535 added
Resolution: duplicate
Status: newclosed

According to #14535 it already crashes with Mesa 17, which I think means the bug is, in fact, not in Mesa at all?

Note: See TracTickets for help on using tickets.