"***Fatal error***" with legacy branch

Need help running G/Q/ZDoom/ECWolf/Zandronum/3DGE? Did your computer break? Ask here.

Moderator: GZDoom Developers

"***Fatal error***" with legacy branch

Postby vanfanel » Fri Jun 15, 2018 7:06 am

Hi there,

I am building drfrag's legacy branch on my X86_64 desktop GNU/Linux system against latest SDL2 running on Xorg+OpenGL/GLES, and I get this on exit, and the GZdoom process gets stuck there, it never gets to quit unless I manually kill it:

Code: Select allExpand view
*** Fatal Error ***


The game runs fine, this error is happening on quit only.

I have noticed that it only happens with SDL2 when it's built without desktop OpenGL support, wich forces SDL2 to use the "opengles2" or "opengles" renderers (note I am talking about the SDL2 renderer, not the GZDoom one).
Since GZDoom should not care about what renderer is SDL2 using, my guess is that it's trying to free something on quit that shouldn't be freed in GLES but only on desktop OpenGL.

Strangely enough, forcing a GLES renderer on an SDL2 built with desktop OpenGL support using this:

Code: Select allExpand view
SDL_HINT_RENDER_DRIVER="opengles2" ./gzdoom


does not cause the **Fatal Error**.

Building SDL2 without OpenGL support is as easy as configuring with:
Code: Select allExpand view
./configure --enable-video-opengles --disable-video-opengl


Why is this bug important to me? Because it happens on both SDL2 running on generic X86_64 Xorg, but also on SDL2 running on X-less enviroments (X86, ARM), where GLES is the only option available.
vanfanel
 
Joined: 24 Mar 2016

Re: "***Fatal error***" with legacy branch

Postby _mental_ » Fri Jun 15, 2018 8:08 am

Run GZDoom in gdb and when the process hangs, do Ctrl+C and bt in the debugger. This may give some clues what's going on.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: "***Fatal error***" with legacy branch

Postby vanfanel » Fri Jun 15, 2018 8:55 am

@_mental_: Backtrace is different each time... I think whatever is wrong, its causing a memory corruption that has different consequences each time:

Execution 1:

Code: Select allExpand view
(gdb) bt
#0  0x00007ffff6159804 in _int_free (av=0x7ffff64a9c20 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:4328
#1  0x00007ffff615e44e in __GI___libc_free (mem=<optimized out>) at malloc.c:3145
#2  0x00005555559d209c in PClass::StaticShutdown() ()
#3  0x0000555555749256 in call_terms() ()
#4  0x00007ffff610aec0 in __run_exit_handlers (status=0, listp=0x7ffff64a96f8 <__exit_funcs>,
    run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:83
#5  0x00007ffff610af1a in __GI_exit (status=<optimized out>) at exit.c:105
#6  0x000055555574c910 in ST_Endoom() ()
#7  0x0000555555bef680 in ?? ()
#8  0x0000555555bef516 in ?? ()
#9  0x0000555555cb0f2f in VMExec_Unchecked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) ()
#10 0x0000555555cb2317 in VMExec_Unchecked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) ()
#11 0x0000555555cbe941 in VMCall(VMFunction*, VMValue*, int, VMReturn*, int) ()
#12 0x0000555555be23da in DMenu::CallMenuEvent(int, bool) ()
#13 0x0000555555be4141 in M_Responder(event_t*) ()
#14 0x00005555559b62e8 in D_ProcessEvents() ()
#15 0x00005555559beaaa in NetUpdate() ()
#16 0x00005555559bf906 in TryRunTics() ()
#17 0x00005555559b8cb9 in D_DoomLoop() ()
#18 0x00005555559ba737 in D_DoomMain() ()
#19 0x000055555572d6ef in main ()



Execution 2:

Code: Select allExpand view
(gdb) bt
#0  0x00007ffff6158086 in malloc_consolidate (av=av@entry=0x7ffff64a9c20 <main_arena>) at malloc.c:4506
#1  0x00007ffff6159e08 in _int_free (av=0x7ffff64a9c20 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:4398
#2  0x00007ffff615e44e in __GI___libc_free (mem=<optimized out>) at malloc.c:3145
#3  0x0000555555c5d6e5 in PSymbolTable::ReleaseSymbols() ()
#4  0x0000555555c5d769 in PSymbolTable::~PSymbolTable() ()
#5  0x0000555555c63e5a in FTypeTable::Clear() ()
#6  0x00005555559d21b9 in PClass::StaticShutdown() ()
#7  0x0000555555749256 in call_terms() ()
#8  0x00007ffff610aec0 in __run_exit_handlers (status=0, listp=0x7ffff64a96f8 <__exit_funcs>,
    run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:83
#9  0x00007ffff610af1a in __GI_exit (status=<optimized out>) at exit.c:105
#10 0x000055555574c910 in ST_Endoom() ()
#11 0x0000555555bef680 in ?? ()
#12 0x0000555555bef516 in ?? ()
#13 0x0000555555cb0f2f in VMExec_Unchecked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) ()
#14 0x0000555555cb2317 in VMExec_Unchecked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) ()
#15 0x0000555555cbe941 in VMCall(VMFunction*, VMValue*, int, VMReturn*, int) ()
#16 0x0000555555be23da in DMenu::CallMenuEvent(int, bool) ()
#17 0x0000555555be4141 in M_Responder(event_t*) ()
#18 0x00005555559b62e8 in D_ProcessEvents() ()
#19 0x00005555559beaaa in NetUpdate() ()
#20 0x00005555559bf906 in TryRunTics() ()
#21 0x00005555559b8cb9 in D_DoomLoop() ()
#22 0x00005555559ba737 in D_DoomMain() ()
#23 0x000055555572d6ef in main ()
(gdb)




Execution 3:
Code: Select allExpand view
(gdb) bt
#0  0x00007ffff6159804 in _int_free (av=0x7ffff64a9c20 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:4328
#1  0x00007ffff615e44e in __GI___libc_free (mem=<optimized out>) at malloc.c:3145
#2  0x00005555559d209c in PClass::StaticShutdown() ()
#3  0x0000555555749256 in call_terms() ()
#4  0x00007ffff610aec0 in __run_exit_handlers (status=0, listp=0x7ffff64a96f8 <__exit_funcs>,
    run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:83
#5  0x00007ffff610af1a in __GI_exit (status=<optimized out>) at exit.c:105
#6  0x000055555574c910 in ST_Endoom() ()
#7  0x0000555555bef680 in ?? ()
#8  0x0000555555bef516 in ?? ()
#9  0x0000555555cb0f2f in VMExec_Unchecked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) ()
#10 0x0000555555cb2317 in VMExec_Unchecked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) ()
#11 0x0000555555cbe941 in VMCall(VMFunction*, VMValue*, int, VMReturn*, int) ()
#12 0x0000555555be23da in DMenu::CallMenuEvent(int, bool) ()
#13 0x0000555555be4141 in M_Responder(event_t*) ()
#14 0x00005555559b62e8 in D_ProcessEvents() ()
#15 0x00005555559beaaa in NetUpdate() ()
#16 0x00005555559bf906 in TryRunTics() ()
#17 0x00005555559b8cb9 in D_DoomLoop() ()
#18 0x00005555559ba737 in D_DoomMain() ()
#19 0x000055555572d6ef in main ()
vanfanel
 
Joined: 24 Mar 2016

Re: "***Fatal error***" with legacy branch

Postby drfrag » Fri Jun 15, 2018 11:38 am

But you already got a crash on exit with 3.3.0:
viewtopic.php?f=2&t=60020#p1047163
Have you tried with 3.3.2? Do you get the crash with vid_renderer 0 in the legacy branch?
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: "***Fatal error***" with legacy branch

Postby vanfanel » Fri Jun 15, 2018 12:46 pm

@drfrag: That was on the Pi3. I am now getting it on the X86_64 laptop, GNU/Linux system running X11, and SDL2 running on X11, not KMSDRM or BCRM. In other words, I am now on "standard" Linux/X11 stuff, and I have found out that the cause for this ***Fatal Error*** seems to be using SDL2 built without OpenGL support.
Can you please build SDL2 without OpenGL and test?

Code: Select allExpand view
./configure --enable-video-opengles --disable-video-opengl


Also, I did clone your repository like this:
Code: Select allExpand view
git clone --depth 1 -b g3.3mgw https://github.com/drfrag666/gzdoom.git


So I am testing 3.4.1 version of the legacy branch, not 3.2.0 anymore.
vanfanel
 
Joined: 24 Mar 2016

Re: "***Fatal error***" with legacy branch

Postby drfrag » Fri Jun 15, 2018 2:55 pm

No sorry. AFAIK there were a couple of SDL related commits since 3.3.0: 'Merged list of video modes for Cocoa and SDL backends' and 'skip rendering when application is not active'. None of the two seem related to your issue.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: "***Fatal error***" with legacy branch

Postby vanfanel » Fri Jun 15, 2018 5:54 pm

drfrag wrote:No sorry. AFAIK there were a couple of SDL related commits since 3.3.0: 'Merged list of video modes for Cocoa and SDL backends' and 'skip rendering when application is not active'. None of the two seem related to your issue.


I don't quite understand your answer: the "No sorry" part. Does that mean I have to clone a different branch? Will you do the test and try to replicate the issue? (It's specially funny because I believe we are both from Spain)
vanfanel
 
Joined: 24 Mar 2016

Re: "***Fatal error***" with legacy branch

Postby drfrag » Fri Jun 15, 2018 6:13 pm

You believe? So you're not sure if you're from Spain... :)
I don't have my new linux computer up and running yet so i haven't even built a linux version myself and about building SDL2... :roll:
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: "***Fatal error***" with legacy branch

Postby vanfanel » Sat Jun 16, 2018 4:09 am

drfrag wrote:You believe? So you're not sure if you're from Spain... :)
I don't have my new linux computer up and running yet so i haven't even built a linux version myself and about building SDL2... :roll:


Yes, I am sure I'm from Spain (living in a small village in Cáceres now :lol: but my english is a bit strange sometimes).
The building process on X86 GNU/Linux is very easy: I can help you with step-by-step instructions if you want. I will assume you're using some debian-derivative such as Ubuntu/Lubuntu... or Debian itself.

-Install libopenal, which is used by GZDoom for audio:
Code: Select allExpand view
sudo apt-get install libopenal-dev


-Remove your distro's SDL2 installation. Since most distros have SDL2 as a dependency for desktop enviroments, you can remove it manually and then reinstall it after you finish the experiments:
Code: Select allExpand view
sudo rm /usr/lib/x86_64-linux-gnu/libSDL2*

-Get the latest stable SDL2 sources, uncompress them, build them and install them:
Code: Select allExpand view
wget https://www.libsdl.org/release/SDL2-2.0.8.tar.gz
tax xvzpf SDL2-2.0.8.tar.gz
cd SDL2-2.0.8
 ./configure --prefix=/usr --enable-video-x11 --disable-video-mir --disable-diskaudio --disable-oss --disable-pulseaudio --disable-dummyaudio --disable-video-dummy --enable-video-opengles --disable-video-opengl
make -j6
sudo make install


Now let's go for your GZDoom branch:

-Clone your sources:

Code: Select allExpand view
git clone --depth 1 -b g3.3mgw https://github.com/drfrag666/gzdoom.git

-cd into the clone repo, create a building dir, and configure using cmake:

Code: Select allExpand view
cd gzdoom
mkdir b3
cd b3
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j6



...And that's pretty much it!
vanfanel
 
Joined: 24 Mar 2016

Re: "***Fatal error***" with legacy branch

Postby drfrag » Sat Jun 16, 2018 6:02 am

So you're the guy from the ZX-One forum? That dondiego guy from Granada is in TestingZone? (ZDP) and we both could be the same person (or not). :) In any case as i said before i still don't have a working linux computer right now.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: "***Fatal error***" with legacy branch

Postby vanfanel » Sat Jun 16, 2018 1:31 pm

@drfrag: Yes! I am Vanfanel on the great ZX-UNO forum, and an inconditional FPGA retro-computing lover. I don't know who dondiego is, I am not in Zona de Pruebas. Totally offtopic: do you have a ZX-UNO too?
And about the thread... do you have any idea on what could be happening? Does GZDoom dynamically load/unload GLES/OpenGL libs somewhere? I can't find such a thing, but the problem seems to be related to that.
vanfanel
 
Joined: 24 Mar 2016

Re: "***Fatal error***" with legacy branch

Postby drfrag » Sat Jun 16, 2018 2:15 pm

Yeah ZX-Uno is great but i'm a very poor guy so i couldn't afford one, i can live with the ZesarUX emulator tough.
No idea but you should really try 3.3.2 to find if the problem is related to a later change (unlikely).
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: "***Fatal error***" with legacy branch

Postby vanfanel » Sat Jun 16, 2018 6:19 pm

@drfrag: No luck.... On every version I try, if I use SDL2 with the "opengles2" or "opengles" videodriver and no opengl support built-in (--disable-video-opengl) I get the same fatal error. GZDoom is assuming something about opengl on SDL2 that shouldn't be assumed...
vanfanel
 
Joined: 24 Mar 2016

Re: "***Fatal error***" with legacy branch

Postby drfrag » Sun Jun 17, 2018 5:31 am

Sorry but i'm afraid i cannot be of any help here, it's not a recent change and it's not something specific to my legacy branch. It seems OpenGL is still required even if you use GLES. But does it work now on the Pi? Should be the same as 3.3.x.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: "***Fatal error***" with legacy branch

Postby vanfanel » Mon Jun 18, 2018 2:07 pm

drfrag wrote:Sorry but i'm afraid i cannot be of any help here, it's not a recent change and it's not something specific to my legacy branch. It seems OpenGL is still required even if you use GLES. But does it work now on the Pi? Should be the same as 3.3.x.


The game DOES work: the **Fatal Error** happens on quit only!
vanfanel
 
Joined: 24 Mar 2016


Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 1 guest