Opened 13 years ago

Closed 13 years ago

#915 closed defect (fixed)

Crash on game exit

Reported by: Roland Häder Owned by:
Priority: Release Blocker Milestone: Alpha 7
Component: Core engine Keywords:
Cc: Jan Wassenberg Patch:

Description

The game crashes at exit, see attached crash log for details.

Attachments (2)

0ad-crash2.txt (4.7 KB ) - added by Roland Häder 13 years ago.
another crash on exit
0ad-crash.txt (9.1 KB ) - added by Roland Häder 13 years ago.
crash dump

Download all attachments as: .zip

Change History (15)

comment:1 by historic_bruno, 13 years ago

Cc: Jan Wassenberg added

comment:2 by Jan Wassenberg, 13 years ago

(In [9961]) cleanup and simplification of the really old h_mgr code. replace array-of-pages data structure with demand-committed VM => allows simple allocation of new resources without having to search for the first free index. I suspect the cause of multiple reported bugs (refs #860, #899, #915) was a race. Most issues are fixed, but the pool's freelist also needs to be made thread-safe and lock-free. this has performance and 64-bit portability implications, so I'll leave it for later (Pool is due for some serious refactoring anyway).

please post a comment if this or similar issues persist.

comment:3 by Roland Häder, 13 years ago

The debug version cannot compile:

ogl_shader.cpp
../../../source/lib/res/graphics/ogl_tex.cpp: In function ‘void warn_if_uploaded(Handle, const OglTex*)’:
../../../source/lib/res/graphics/ogl_tex.cpp:589:14: error: expected primary-expression before ‘>’ token
../../../source/lib/res/graphics/ogl_tex.cpp:588:11: warning: unused variable ‘refs’ [-Wunused-variable]
make[1]: *** [obj/lowlevel_Debug/ogl_tex.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [lowlevel] Error 2

gcc --version: gcc (Debian 4.6.0-6) 4.6.1 20110428 (prerelease)

comment:4 by Kieran P, 13 years ago

Milestone: BacklogAlpha 7

comment:5 by Jan Wassenberg, 13 years ago

Sorry about that, that typo was fixed shortly thereafter. Interesting that compiling with optimizations enabled worked, though :)

by Roland Häder, 13 years ago

Attachment: 0ad-crash2.txt added

another crash on exit

comment:6 by Roland Häder, 13 years ago

Okay, that worked. And I had that crash after I have played a little on some SP maps.

Got another crash at exit.

by Roland Häder, 13 years ago

Attachment: 0ad-crash.txt added

crash dump

comment:7 by Roland Häder, 13 years ago

It is simple to reproduce:

  • Launch 0ad
  • Single player -> start with default map, disable AI (unassigned)
  • Play a little
  • Quit map
  • Quit game

comment:8 by historic_bruno, 13 years ago

Looks very similar to #920.

comment:9 by historic_bruno, 13 years ago

Are you using autostart or going though game setup?

comment:10 by historic_bruno, 13 years ago

Priority: Should HaveMust Have

I tested on Ubuntu 11.04 amd64 and got very similar results:

h_mgr: expected handle 7fffee71a620, got 339fb0197
h_mgr.cpp(235): Function call failed: return value was -120003 (Handle tag mismatch (stale reference?))
Function call failed: return value was -120003 (Handle tag mismatch (stale reference?))
Location: h_mgr.cpp:235 (h_data_tag)

Call stack:

(0x77458a) /home/ben/0ad/binaries/system/pyrogenesis() [0x77458a]
(0x71c5d9) /home/ben/0ad/binaries/system/pyrogenesis() [0x71c5d9]
(0x71c850) /home/ben/0ad/binaries/system/pyrogenesis() [0x71c850]
(0x71d364) /home/ben/0ad/binaries/system/pyrogenesis() [0x71d364]
(0x73f287) /home/ben/0ad/binaries/system/pyrogenesis() [0x73f287]
(0x7464a9) /home/ben/0ad/binaries/system/pyrogenesis() [0x7464a9]
(0x73f041) /home/ben/0ad/binaries/system/pyrogenesis() [0x73f041]
(0x73f167) /home/ben/0ad/binaries/system/pyrogenesis() [0x73f167]
(0x71e623) /home/ben/0ad/binaries/system/pyrogenesis() [0x71e623]
(0x557767) /home/ben/0ad/binaries/system/pyrogenesis() [0x557767]
(0x413a25) /home/ben/0ad/binaries/system/pyrogenesis() [0x413a25]
(0x415193) /home/ben/0ad/binaries/system/pyrogenesis() [0x415193]
(0x7ffff46d0eff) /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xff) [0x7ffff46d0eff]
(0x411ad9) /home/ben/0ad/binaries/system/pyrogenesis() [0x411ad9]

errno = 0 (No error reported here)
OS error = ?


Sleeping until debugger attaches.
Please wait.
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Attaching to process 25755
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
(gdb) 
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff46e5fe7 in kill () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt full
#0  0x00007ffff46e5fe7 in kill () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#1  0x000000000073f291 in h_data_tag_type (h=<value optimized out>, 
    type=<value optimized out>) at ../../../source/lib/res/h_mgr.cpp:253
        suppress__ = 0
#2  h_free (h=<value optimized out>, type=<value optimized out>)
    at ../../../source/lib/res/h_mgr.cpp:583
        status_ = -120003
        h_copy = <value optimized out>
        hd = <value optimized out>
#3  0x00000000007464a9 in destroy (c=0x7fffee727e40)
    at ../../../source/lib/res/graphics/cursor.cpp:110
No locals.
#4  Cursor_dtor (c=0x7fffee727e40)
    at ../../../source/lib/res/graphics/cursor.cpp:178
        __func__ = "Cursor_dtor"
#5  0x000000000073f041 in h_free_hd (hd=0x7fffee727e00)
    at ../../../source/lib/res/h_mgr.cpp:549
        vtbl = <value optimized out>
#6  0x000000000073f167 in Shutdown () at ../../../source/lib/res/h_mgr.cpp:747
        hd = 0x7fffee727e00
#7  0x000000000071e623 in ModuleShutdown (initState=0xa84718, 
    shutdown=0x73f100 <Shutdown()>) at ../../../source/lib/module_init.cpp:71
---Type <return> to continue, or q <return> to quit---
        latchedInitState = <value optimized out>
        __func__ = "ModuleShutdown"
#8  0x0000000000557767 in Shutdown ()
    at ../../../source/ps/GameSetup/GameSetup.cpp:668
        LINE_661_ = {m_t0 = 72.122715133, 
          m_description = 0x7b6700 L"resource modules"}
#9  0x0000000000413a25 in RunGameOrAtlas (argc=<value optimized out>, 
    argv=<value optimized out>) at ../../../source/main.cpp:493
        args = {
          m_Args = {<std::_Vector_base<std::pair<CStr8, CStr8>, std::allocator<std::pair<CStr8, CStr8> > >> = {
              _M_impl = {<std::allocator<std::pair<CStr8, CStr8> >> = {<__gnu_cxx::new_allocator<std::pair<CStr8, CStr8> >> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, 
                _M_end_of_storage = 0x0}}, <No data fields>}, m_Arg0 = {
            path = {static npos = <optimized out>, 
              _M_dataplus = {<std::allocator<wchar_t>> = {<__gnu_cxx::new_allocator<wchar_t>> = {<No data fields>}, <No data fields>}, 
                _M_p = 0xa8d1c8 L"/home/ben/0ad/binaries/system/pyrogenesis"}}, separator = 47 L'/'}}
        ran_atlas = <value optimized out>
        res = <value optimized out>
#10 0x0000000000415193 in main (argc=1, argv=0x7fffffffe2c8)
---Type <return> to continue, or q <return> to quit---
    at ../../../source/main.cpp:511
No locals.

comment:11 by historic_bruno, 13 years ago

Priority: Must HaveRelease Blocker

If we can't fix this before release, I'd suggest removing the error or only showing it in debug builds. It would look really ugly to have this in Alpha 7 though :)

Also I'm closing #920 which is a duplicate report.

comment:12 by Erik Johansson, 13 years ago

I assume Jan will be able to fix it, he's away on a conference currently and won't be home until the 5th though, but hopefully he'll have a moment or two next week.

comment:13 by Jan Wassenberg, 13 years ago

Resolution: fixed
Status: newclosed

(In [10243]) h_mgr: fix simple double-free warning triggered at shutdown when an object's child was freed AND the all objects were forcibly freed (complicated by the fact that the pool allocator overwrites freed storage, which made this appear to be a tag conflict). fixes #860, #915, #920

Note: See TracTickets for help on using tickets.