Skip to main content

News

Topic: Sphere 5.5.1 (miniSphere) (Read 412541 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: minisphere 1.5.3
Reply #750
Edited post w/new error.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: minisphere 1.5.3
Reply #751
These are weird.  They look like double free bugs, but I would think they should have shown up in the Windows and Linux builds by now if so.  Does it always crash shutting down Audialis?  Or is it in a different spot each time?
Sphere 5.5.1 - miniSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: minisphere 1.5.3
Reply #752
Try using lldb to see where crash is (or at least the second free)?

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: minisphere 1.5.3
Reply #753

Try using lldb to see where crash is (or at least the second free)?



lldb output for running engine but canceling the Open File:

Code: [Select]

[ ... ]
Setting up jump points for longjmp
Looking for a game to launch
Opening game ''
engine(32663,0x102a9e000) malloc: *** error for object 0x10081be00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Process 32663 stopped
* thread #6: tid = 0x325f34, 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
    frame #0: 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill + 10:
-> 0x7fff96371866:  jae    0x7fff96371870            ; __pthread_kill + 20
   0x7fff96371868:  movq   %rax, %rdi
   0x7fff9637186b:  jmp    0x7fff9636e175            ; cerror_nocancel
   0x7fff96371870:  retq  


lldb output for running engine with my one-liner:
Code: [Select]

[ ... ]
Shutting down spriteset manager
Shutting down Audialis
engine(32687,0x102a9e000) malloc: *** error for object 0x101809a00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Process 32687 stopped
* thread #6: tid = 0x3263bb, 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
    frame #0: 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill + 10:
-> 0x7fff96371866:  jae    0x7fff96371870            ; __pthread_kill + 20
   0x7fff96371868:  movq   %rax, %rdi
   0x7fff9637186b:  jmp    0x7fff9636e175            ; cerror_nocancel
   0x7fff96371870:  retq  


I don't know how to read debugger, sorry.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: minisphere 1.5.3
Reply #754
No stack trace?

Interesting that it's crashing at the exact same instruction, though.  Which means it's probably the same root cause.  Unfortunately I don't have a Mac to test this on myself.
Sphere 5.5.1 - miniSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: minisphere 1.5.3
Reply #755
At the crash, type `bt` to get a backtrace.

Then, I suggest typing `frame s 1` to see the second frame, and continuing this (but with increasing stack frame numbers) until you get an actual snippet of source with line numbers rather than just assembly.

Really unfortunately, llbd is much more verbose and difficult to use than gdb :(

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: minisphere 1.5.3
Reply #756
@NEO:
Okay, from what I can tell from the console output, the first one it looks like the file dialog on OSX is returning true when it shouldn't, judging by this line: Opening game '').  That should be simple enough to fix.

The Audialis shutdown crash I think I have a lead on, but I'd need to see your entire console log, from "Parsing command line" on.
Sphere 5.5.1 - miniSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: minisphere 1.5.3
Reply #757

The Audialis shutdown crash I think I have a lead on, but I'd need to see your entire console log, from "Parsing command line" on.


Dump:
Code: [Select]

Parsing command line
  Game path: <none provided>
  Frameskip limit: 5 frames
  CPU throttle: ON
  Console verbosity: L1

Initializing Allegro
Initializing Dyad
Loading system configuration
Initializing async manager
Initializing Mersenne Twister
Initializing Galileo
Initializing Audialis
Initializing input
Initializing spriteset manager
Initializing map engine
Initializing persons manager
Initializing Duktape
Initializing CoffeeScript
  Error evaluating compiler script  RangeError: compiler recursion limit (line 8)'CoffeeScript' not definedInitializing Sphere API
  v2.0 (minisphere 1.5.2)
  minisphere
  sphere-legacy-api
  sphere-obj-constructors
  sphere-obj-props
  sphere-audialis
  sphere-coffeescript
  sphere-commonjs
  sphere-galileo
  sphere-map-engine
  sphere-spherefs
  minisphere-async-api
  minisphere-new-sockets
  minisphere-rng-object
  minisphere-galileo-shaders
  frameskip-api
  set-script-function
Setting up jump points for longjmp
Looking for a game to launch
Opening game '/Users/lux/dev/minisphere/bin/games/nmix/game.sgm'
  Title: NMix
  Author: NeoLogiX
  Resolution: 320x240
Creating render window
Initializing shader manager

Fragment shader compile log:
ERROR: 0:10: 'blend_mode' : syntax error syntax error

  System shaders not found
Loading system font
Calling game()

JS Error: game.js:6 - Error: Hello, mixer!
Shutting down map engine
Shutting down persons manager
Shutting down input
Shutting down Duktape
Shutting down Dyad
Shutting down spriteset manager
Shutting down Audialis
engine(32687,0x102a9e000) malloc: *** error for object 0x101809a00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Process 32687 stopped
* thread #6: tid = 0x3263bb, 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
    frame #0: 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill + 10:
-> 0x7fff96371866:  jae    0x7fff96371870            ; __pthread_kill + 20
   0x7fff96371868:  movq   %rax, %rdi
   0x7fff9637186b:  jmp    0x7fff9636e175            ; cerror_nocancel
   0x7fff96371870:  retq  


Re backtrace - `bt` and interesting frames are as follows:

Code: [Select]

* thread #6: tid = 0x33298d, 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
  * frame #0: 0x00007fff96371866 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff92a1c35c libsystem_pthread.dylib`pthread_kill + 92
    frame #2: 0x00007fff96f58b1a libsystem_c.dylib`abort + 125
    frame #3: 0x00007fff9161707f libsystem_malloc.dylib`free + 411
    frame #4: 0x00000001000e29c6 liballegro_audio.5.1.dylib`_aqueue_deallocate_voice(voice=0x00000001005359f0) + 70 at aqueue.m:212
    frame #5: 0x00000001000e1a38 liballegro_audio.5.1.dylib`al_destroy_voice(voice=0x00000001005359f0) + 40 at kcm_voice.c:114
    frame #6: 0x0000000100164bab liballegro.5.1.dylib`_al_run_destructors(dtors=0x0000000100535980) + 155 at dtor.c:117
    frame #7: 0x00000001000d8675 liballegro_audio.5.1.dylib`_al_kcm_shutdown_destructors + 21 at kcm_dtor.c:46
    frame #8: 0x00000001000d74e8 liballegro_audio.5.1.dylib`al_uninstall_audio + 24 at audio.c:401
    frame #9: 0x0000000100166108 liballegro.5.1.dylib`_al_run_exit_funcs + 136 at exitfunc.c:92
    frame #10: 0x000000010016cac5 liballegro.5.1.dylib`al_uninstall_system + 21 at system.c:298
    frame #11: 0x00007fff96f59794 libsystem_c.dylib`__cxa_finalize + 164
    frame #12: 0x00007fff96f59a4c libsystem_c.dylib`exit + 22
    frame #13: 0x00000001001a77be liballegro.5.1.dylib`+[AllegroAppDelegate app_main:] [inlined] call_user_main + 30 at osx_app_delegate.m:214
    frame #14: 0x00000001001a77a4 liballegro.5.1.dylib`+[AllegroAppDelegate app_main:](self=<unavailable>, _cmd=<unavailable>, arg=<unavailable>) + 4 at osx_app_delegate.m:225
    frame #15: 0x00007fff917d0d8b Foundation`__NSThread__main__ + 1318
    frame #16: 0x00007fff92a1b899 libsystem_pthread.dylib`_pthread_body + 138
    frame #17: 0x00007fff92a1b72a libsystem_pthread.dylib`_pthread_start + 137
    frame #18: 0x00007fff92a1ffc9 libsystem_pthread.dylib`thread_start + 13


Code: [Select]

frame #4: 0x00000001000e29c6 liballegro_audio.5.1.dylib`_aqueue_deallocate_voice(voice=0x00000001005359f0) + 70 at aqueue.m:212
   209 static void _aqueue_deallocate_voice(ALLEGRO_VOICE *voice)
   210 {
   211    al_free(voice->extra);
-> 212    al_free(silence);
   213    voice->extra = NULL;
   214 }
   215

frame #5: 0x00000001000e1a38 liballegro_audio.5.1.dylib`al_destroy_voice(voice=0x00000001005359f0) + 40 at kcm_voice.c:114
   111       ASSERT(al_get_voice_playing(voice) == false);
   112
   113       /* We do NOT lock the voice mutex when calling this method. */
-> 114       voice->driver->deallocate_voice(voice);
   115       al_destroy_mutex(voice->mutex);
   116       al_destroy_cond(voice->cond);
   117



The problem very well could be audio. Among other things, I got warnings about missing libdumb and libvorbis for some reason during early attempts to compile, and when I followed the wrong instructions early on and CMake'ed it to be a Framework it kept giving "unexpectedly closed" errors during the process.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: minisphere 1.5.3
Reply #758
Looks like the crash is inside of Allegro.  What's interesting is that it's crashing on trying to free the silence buffer...  Looks like I'll be putting in another bug report. :P

Also odd: CoffeeScript errors out, and the shaders fail to compile also.  Not sure what's going on there!
Sphere 5.5.1 - miniSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: minisphere 1.5.3
Reply #759
Interesting, apparently for whatever reason your system doesn't like uint uniforms in shaders.  That same shader compiles fine on every Windows machine I've tested on, although I can't speak for Linux as I've never seen DaVince's startup listing.  In any case, the uniform in question wasn't even used (it was part of a failed attempt to implement blending in the fragment shader), so I removed it and also cleaned up the CoffeeScript output (I forgot to add newlines).

I did manage to fix (or think I fixed) the crash on canceling the file dialog.  Apparently al_show_native_file_dialog() returns true on OS X on cancel, even though it returns false in that circumstance seemingly everywhere else.  Then again, I probably just misinterpreted the documentation:
Code: [Select]
Returns true on success, false on failure.


I originally interpreted "failure" to mean "the user closed the dialog", but that might not have been the intent, since Allegro provides a different function, al_get_native_file_dialog_count(), which returns the number of files selected.  If the user cancels, the documentation says explicitly that this will return zero.  So that's what I used.
  • Last Edit: July 19, 2015, 03:05:21 am by Lord English
Sphere 5.5.1 - miniSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: minisphere 1.5.3
Reply #760
*** set a breakpoint in malloc_error_break to debug

Just compiled 1.5.3 and same errors when trying to free audio, but seems like it gets there much faster now so whatever you did to fix OSX open file dialog seems to work. How do I set a breakpoint to confirm the above?
  • Last Edit: July 19, 2015, 01:48:42 pm by N E O

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: minisphere 1.5.3
Reply #761
I don't know anything about lldb, but could you checkout the latest source, run the engine with the option --log-level 4 and post the console output?
Sphere 5.5.1 - miniSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: minisphere 1.5.3
Reply #762
I don't think setting a breakpoint there would help much unless you had a really good knowledge of Allegro. You basically need to know exactly what is going on in the function directly above the one you set a breakpoint at the edge of.

In any case, in lldb it looks a little like this:
Code: [Select]
breakpoint set -f <filename> -l <line>

You need to set breakpoints either before you type `run` or at the prompt you get by hitting ctrl+c at the terminal while the program is running (or when another breakpoint is triggered, either from a set breakpoint or from a segfault)

I don't recall the syntax for setting it at edges of certain functions. This is where lldb's syntax is really annoying. Everywhere else it's basically just an extra letter here or there, but with breakpoints its fairly obtuse compared to gdb, Intel's debugger, and MS's command line debugger.
  • Last Edit: July 20, 2015, 01:07:38 am by Flying Jester

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: minisphere 1.5.3
Reply #763
MS has a command-line debugger?  I never knew that.  The only one I ever remember is the DEBUG command in DOS.  And that was more of a disassembler than a debugger anyway.

As for this crash, the most interesting part to me is the stack trace.  There is no user code on the stack at all--only Allegro functions and system calls.  this makes no sense to me since the last thing printed to the console is "Shutting down Audialis", whereas in a clean shutdown there are a few more steps after that.  So there should definitely be engine code on the stack at that point, but there clearly isn't.  I'm baffled.

edit: Hey, I have an idea!  Any chance you could run the engine under valgrind?  That tends to find weird memory bugs like this.
  • Last Edit: July 20, 2015, 01:58:20 am by Lord English
Sphere 5.5.1 - miniSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: minisphere 1.5.3
Reply #764

I don't know anything about lldb, but could you checkout the latest source, run the engine with the option --log-level 4 and post the console output?


Log for canceling game load:
Code: [Select]

Parsing command line
  Game path: <none provided>
  Frameskip limit: 5 frames
  CPU throttle: ON
  Console verbosity: L4

Initializing Allegro
Initializing Dyad
Loading system configuration
Opening File 0 as '~sys/system.ini'
Initializing async manager
Initializing Mersenne Twister
Seeding MT19937 (1437418155)
Initializing Galileo
Initializing Audialis
Creating new Mixer 0 at 44 kHz
  Format: 2ch 44100 Hz, 16-bit
Incrementing Mixer 0 refcount, new: 1
Initializing input
Opening File 1 as '~sys/../minisphere.conf'
Reading key 'keymap_Player1_MENU' from File 1
Reading key 'keymap_Player1_UP' from File 1
Reading key 'keymap_Player1_DOWN' from File 1
Reading key 'keymap_Player1_LEFT' from File 1
Reading key 'keymap_Player1_RIGHT' from File 1
Reading key 'keymap_Player1_A' from File 1
Reading key 'keymap_Player1_B' from File 1
Reading key 'keymap_Player1_X' from File 1
Reading key 'keymap_Player1_Y' from File 1
Reading key 'keymap_Player2_MENU' from File 1
Reading key 'keymap_Player2_UP' from File 1
Reading key 'keymap_Player2_DOWN' from File 1
Reading key 'keymap_Player2_LEFT' from File 1
Reading key 'keymap_Player2_RIGHT' from File 1
Reading key 'keymap_Player2_A' from File 1
Reading key 'keymap_Player2_B' from File 1
Reading key 'keymap_Player2_X' from File 1
Reading key 'keymap_Player2_Y' from File 1
Reading key 'keymap_Player3_MENU' from File 1
Reading key 'keymap_Player3_UP' from File 1
Reading key 'keymap_Player3_DOWN' from File 1
Reading key 'keymap_Player3_LEFT' from File 1
Reading key 'keymap_Player3_RIGHT' from File 1
Reading key 'keymap_Player3_A' from File 1
Reading key 'keymap_Player3_B' from File 1
Reading key 'keymap_Player3_X' from File 1
Reading key 'keymap_Player3_Y' from File 1
Reading key 'keymap_Player4_MENU' from File 1
Reading key 'keymap_Player4_UP' from File 1
Reading key 'keymap_Player4_DOWN' from File 1
Reading key 'keymap_Player4_LEFT' from File 1
Reading key 'keymap_Player4_RIGHT' from File 1
Reading key 'keymap_Player4_A' from File 1
Reading key 'keymap_Player4_B' from File 1
Reading key 'keymap_Player4_X' from File 1
Reading key 'keymap_Player4_Y' from File 1
File 1 no longer in use, deallocating
Initializing spriteset manager
Initializing map engine
Initializing persons manager
Initializing JavaScript
  Duktape v1.2.2
  Error evaluating compiler script
  RangeError: compiler recursion limit (line 8)
  CoffeeScript support not enabled
Initializing Sphere API
  v2.0 (minisphere 1.5.3)
  minisphere
  sphere-legacy-api
  sphere-obj-constructors
  sphere-obj-props
  sphere-audialis
  sphere-coffeescript
  sphere-commonjs
  sphere-galileo
  sphere-map-engine
  sphere-spherefs
  minisphere-async-api
  minisphere-galileo-shaders
  minisphere-new-sockets
  minisphere-rng-object
  frameskip-api
  set-script-function
Reading key 'Arrow' from File 0
Loading Image 0 as '~sys/pointer.png'
Reading key 'UpArrow' from File 0
Loading Image 1 as '~sys/up_arrow.png'
Reading key 'DownArrow' from File 0
Loading Image 2 as '~sys/down_arrow.png'
Reading key 'WindowStyle' from File 0
Reading 16x16 Image 3 from open file
Reading 16x16 Image 4 from open file
Reading 16x16 Image 5 from open file
Reading 16x16 Image 6 from open file
Reading 16x16 Image 7 from open file
Reading 16x16 Image 8 from open file
Reading 16x16 Image 9 from open file
Reading 16x16 Image 10 from open file
Reading 16x16 Image 11 from open file
Setting up jump points for longjmp
Looking for a game to launch
engine(37145,0x10f111000) malloc: *** error for object 0x7fd01480da00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6


Re valgrind - I don't know how to use valgrind, but homebrew seems to let me install it.