Crash - r492

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
winston
Pirate
Pirate
Posts: 731
Joined: Mon Sep 27, 2004 10:21 pm
Location: Port St. Mary, Isle of Man
Contact:

Crash - r492

Post by winston »

It just died on me - once while scooping cargo, and once just while in hyperspeed. Here is the backtrace:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208104096 (LWP 4624)]
0x0813dadd in -[Universe update:] (self=0xa304ab8, _cmd=0x8185228,
    delta_t=0.020028012790135108) at src/Core/Universe.m:5280
5280                                    while ((index > 0)&&(p0.y < y_sortedEntities[index - 1]->position.y))
(gdb) bt
#0  0x0813dadd in -[Universe update:] (self=0xa304ab8, _cmd=0x8185228,
    delta_t=0.020028012790135108) at src/Core/Universe.m:5280
#1  0x0806080a in -[GameController doStuff:] (self=0xa19bab8, _cmd=0x8189148,
    sender=0x0) at src/Core/GameController.m:510
#2  0x080783fd in -[MyOpenGLView pollControls:] (self=0xa1a3878,
    _cmd=0x81851d0, sender=0xafd85b8) at src/SDL/MyOpenGLView.m:1015
#3  0x0061c6e2 in -[NSObject performSelector:withObject:] (self=0xa1a3878,
    _cmd=0x7dcd58, aSelector=0x81851d0, anObject=0xafd85b8) at NSObject.m:1782
#4  0x0066dc92 in -[NSTimer fire] (self=0xafd85b8, _cmd=0x7d20f8)
    at NSTimer.m:219
#5  0x00642185 in -[NSRunLoop limitDateForMode:] (self=0xafaea40,
    _cmd=0x7d2060, mode=0x7d21e8) at NSRunLoop.m:843
#6  0x0064072b in -[NSRunLoop runMode:beforeDate:] (self=0xafaea40,
    _cmd=0x7d2190, mode=0x7d21e8, date=0xa9d3a08) at NSRunLoop.m:1109
#7  0x00640620 in -[NSRunLoop runUntilDate:] (self=0xafaea40, _cmd=0x7d2188,
    date=0xa9d3a08) at NSRunLoop.m:1167
#8  0x0063f1a2 in -[NSRunLoop run] (self=0xafaea40, _cmd=0x8185200)
    at NSRunLoop.m:1150
#9  0x0806063a in -[GameController applicationDidFinishLaunching:] (
    self=0xa19bab8, _cmd=0x8187e50, notification=0x0)
    at src/Core/GameController.m:375
#10 0x08074cf6 in main (argc=1, argv=0xbf8eea74) at src/SDL/main.m:52
Contents of variables (the listing of y_sortedEntities just shows the array itself appears to be perfectly valid - didn't bother po'ing any of them)

Code: Select all


(gdb) p index
$1 = 42
(gdb) p p0
$2 = {x = 15895.2256, y = 15212.6348, z = 587336.25}
(gdb) p y_sortedEntities
$3 = {0xb05ab010, 0xa3dd9e8, 0xb4e04010, 0xad94b010, 0xb52ad010, 0xadb2b010,
  0xb2320010, 0xb24e2010, 0xb4e54010, 0xb4cc4010, 0xaddfb010, 0xadeeb010,
  0xb0c69010, 0xb1119010, 0xb1079010, 0xadb7b010, 0xadbcb010, 0xb48fd010,
  0xadc1b010, 0xb0cb9010, 0xadcbb010, 0xb10c9010, 0xb47e9010, 0xb07df010,
  0xadadb010, 0xb1029010, 0xb622f010, 0xb3db4010, 0xb0c19010, 0xb0bc9010,
  0xb0a89010, 0xb0a39010, 0xb0ad9010, 0xb0b79010, 0xb1597010, 0xb0b29010,
  0xb0f39010, 0xb1b69010, 0xadc6b010, 0x0, 0x0, 0x0, 0x0, 0xadd0b010,
  0x0 <repeats 2004 times>}
(gdb) p position
$4 = 0
The one we're mucking with is NULL though:

Code: Select all

(gdb) p y_sortedEntities[index - 1]
$5 = (class Entity *) 0x0
which is what is causing our signal 11.

It is interesting to note index is 42, which is of course The Answer to Life, The Universe and Everything. One would hope the question isn't SIGSEGV :-)
User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Yeah I flubbed removeEntity: should be fixed with the latest revision.

Incidentally, what I'm trying to do here is establish some filtering of entities prior to collision detection. We'll maintain three lists of entities - sorted along the x-axis, y-axis and z-axis.

If any entity has clear space between itself and the entities before and after it in the list - then it cannot collide with anything, so should be eliminated from collision testing. This should cut collision testing time dramatically.
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
User avatar
winston
Pirate
Pirate
Posts: 731
Joined: Mon Sep 27, 2004 10:21 pm
Location: Port St. Mary, Isle of Man
Contact:

Post by winston »

aegidian wrote:
If any entity has clear space between itself and the entities before and after it in the list - then it cannot collide with anything, so should be eliminated from collision testing. This should cut collision testing time dramatically.
Especially with lots of entities - it'll change from scaling O(n^2) to O(n) or maybe better. I probably ought to study the code at some time, collision detection isn't something I've ever really had the need to think about in the past :-)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Naïve collision detection isn’t O(n^2), it’s O(2^n), as you need to check everything against everything else. (As such, even a full sorting pass each frame would improve scalability. I’m slightly miffed that I didn’t think of this when I was looking at the collision code a feew months back.)
User avatar
Ponder
Dangerous
Dangerous
Posts: 64
Joined: Fri Mar 31, 2006 2:03 pm
Location: Cardiff, UK

Post by Ponder »

Using r493 and it's almost unplayable. Can't get very far without a segmentation fault. Here's the last one:

Code: Select all

2006-04-25 14:46:22.662 oolite[19194] File NSUserDefaults.m: 561. In [NSUserDefaults +standardUserDefaults] Improper installation: No language locale found
2006-04-25 14:46:22.664 oolite[19194] initialising SDL
2006-04-25 14:46:22.682 oolite[19194] init: numSticks=0
2006-04-25 14:46:22.682 oolite[19194] CREATING MODE LIST
2006-04-25 14:46:22.683 oolite[19194] Added res 1152 x 864
2006-04-25 14:46:22.683 oolite[19194] Added res 1024 x 768
2006-04-25 14:46:22.683 oolite[19194] Added res 832 x 624
2006-04-25 14:46:22.683 oolite[19194] Added res 800 x 600
2006-04-25 14:46:22.683 oolite[19194] Added res 640 x 512
2006-04-25 14:46:22.683 oolite[19194] Added res 576 x 432
2006-04-25 14:46:22.684 oolite[19194] Added res 512 x 384
2006-04-25 14:46:22.684 oolite[19194] Added res 416 x 312
2006-04-25 14:46:22.684 oolite[19194] Added res 400 x 300
2006-04-25 14:46:22.684 oolite[19194] Added res 320 x 240
2006-04-25 14:46:22.858 oolite[19194] drawRect calling initialiseGLWithSize
2006-04-25 14:46:22.858 oolite[19194] Creating a new surface of 1028 x 743
2006-04-25 14:46:22.868 oolite[19194] no universe, clearning surface
2006-04-25 14:46:22.878 oolite[19194] ---> searching paths:
("/usr/lib/Oolite/oolite.app/Contents/Resources", "/usr/lib/Oolite/AddOns", "/home/ponder/Library/Application Support/Oolite/AddOns", "/home/ponder/.Oolite/AddOns", "/usr/lib/Oolite/AddOns/tori.oxp", "/usr/lib/Oolite/AddOns/behemoth.oxp", "/usr/lib/Oolite/AddOns/ionics-1.2.1.oxp", "/usr/lib/Oolite/AddOns/kleptohud.oxp", "/usr/lib/Oolite/AddOns/supercobra.oxp", "/usr/lib/Oolite/AddOns/xships.oxp","/usr/lib/Oolite/AddOns/thargoid_wars.oxp", "/usr/lib/Oolite/AddOns/x-ships.oxp")
2006-04-25 14:46:22.878 oolite[19194] DEBUG ** no cache exists - yet **
2006-04-25 14:46:23.080 oolite[19194] Vertex Array Range optimisation - not supported
2006-04-25 14:46:23.081 oolite[19194] DEBUG creating octree cache......
2006-04-25 14:46:24.077 oolite[19194] Populating a system with economy 5, and government 3
2006-04-25 14:46:24.077 oolite[19194] ... adding 3 trading vessels
2006-04-25 14:46:24.077 oolite[19194] ... adding 0 sun skimming vessels
2006-04-25 14:46:24.078 oolite[19194] ... adding 4 pirate vessels
2006-04-25 14:46:24.078 oolite[19194] ... adding 0 sun skim pirates
2006-04-25 14:46:24.078 oolite[19194] ... adding 1 law/bounty-hunter vessels
2006-04-25 14:46:24.078 oolite[19194] ... adding 0 sun skim law/bounty hunter vessels
2006-04-25 14:46:24.078 oolite[19194] ... adding 1 Thargoid warships
2006-04-25 14:46:24.078 oolite[19194] ... adding 4 asteroid clusters
2006-04-25 14:46:24.079 oolite[19194] ... for a total of 13 ships
2006-04-25 14:46:24.959 oolite[19194] OPENGL_DEBUG GL_ERROR (1280) 'invalid enumerant' in: Universe before doing anything
2006-04-25 14:46:27.503 oolite[19194] Populating a system with economy 2, and government 0
2006-04-25 14:46:27.503 oolite[19194] ... adding 5 trading vessels
2006-04-25 14:46:27.504 oolite[19194] ... adding 4 sun skimming vessels
2006-04-25 14:46:27.504 oolite[19194] ... adding 22 pirate vessels
2006-04-25 14:46:27.504 oolite[19194] ... adding 1 sun skim pirates
2006-04-25 14:46:27.504 oolite[19194] ... adding 1 law/bounty-hunter vessels
2006-04-25 14:46:27.504 oolite[19194] ... adding 0 sun skim law/bounty hunter vessels
2006-04-25 14:46:27.504 oolite[19194] ... adding 0 Thargoid warships
2006-04-25 14:46:27.505 oolite[19194] ... adding 0 asteroid clusters
2006-04-25 14:46:27.505 oolite[19194] ... for a total of 33 ships
2006-04-25 14:46:28.468 oolite[19194] SCRIPT debug messages ON
2006-04-25 14:46:28.468 oolite[19194] SCRIPT debug messages OFF
2006-04-25 14:46:28.470 oolite[19194] SCRIPT debug messages ON
2006-04-25 14:46:28.470 oolite[19194] SCRIPT debug messages OFF
2006-04-25 14:46:37.328 oolite[19194]

***** Encountered localException during initialisation in [Universe update:] : NSInvalidArgumentException : GSCInlineString(instance) does not recognize count *****

2006-04-25 14:46:37.328 oolite[19194] *** NSTimer ignoring exception 'NSInvalidArgumentException' (reason 'GSCInlineString(instance) does not recognize count')raised during posting of timer with target 0x82ac798 and selector 'pollControls:'
2006-04-25 14:47:22.826 oolite[19194] Populating a system with economy 5, and government 3
2006-04-25 14:47:22.827 oolite[19194] ... adding 3 trading vessels
2006-04-25 14:47:22.827 oolite[19194] ... adding 2 sun skimming vessels
2006-04-25 14:47:22.827 oolite[19194] ... adding 13 pirate vessels
2006-04-25 14:47:22.827 oolite[19194] ... adding 3 sun skim pirates
2006-04-25 14:47:22.828 oolite[19194] ... adding 1 law/bounty-hunter vessels
2006-04-25 14:47:22.828 oolite[19194] ... adding 0 sun skim law/bounty hunter vessels
2006-04-25 14:47:22.828 oolite[19194] ... adding 0 Thargoid warships
2006-04-25 14:47:22.828 oolite[19194] ... adding 0 asteroid clusters
2006-04-25 14:47:22.828 oolite[19194] ... for a total of 22 ships
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
ss
Erk. It looks like Oolite died with an error. When making an error
report, please copy + paste the log above into the report.

(Press Ctrl-C to continue)
Image
User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Well I'm working my way through the Game Programming Gems series, albeit in a somewhat random order. This is a result of looking at GPG Vol 2 Section 2.7 Recursive Dimensional Clustering: A Fast Algorithm for collision detection by Steve Rabin and partially implementing it by looking for singletons rather than groups.
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Mmm. I'm getting bad values for the stored x_index (or y_index or z_index) occasionally. I haven't figured out why yet.
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
User avatar
winston
Pirate
Pirate
Posts: 731
Joined: Mon Sep 27, 2004 10:21 pm
Location: Port St. Mary, Isle of Man
Contact:

Post by winston »

Ahruman wrote:
Naïve collision detection isn’t O(n^2), it’s O(2^n),
Duh (/me drools). That's what I meant.

Note: People should be reading what I mean, not what I say :-)
User avatar
winston
Pirate
Pirate
Posts: 731
Joined: Mon Sep 27, 2004 10:21 pm
Location: Port St. Mary, Isle of Man
Contact:

Post by winston »

Ponder wrote:
Using r493 and it's almost unplayable. Can't get very far without a segmentation fault.
If you're building from source, you can get more information by running "make debug=yes" then running "debugapp oolite.debug". Then when it crashes, pull your debugger window to the front and type 'bt' (backtrace). You can also examine objects (see my initial message in this thread for how it's done). All this is highly valuable!
User avatar
Ponder
Dangerous
Dangerous
Posts: 64
Joined: Fri Mar 31, 2006 2:03 pm
Location: Cardiff, UK

Post by Ponder »

Unfortunately I just got the latest autopackage then rsync every day.
Image
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

The “ NSInvalidArgumentException : GSCInlineString(instance) does not recognize count” is the GNUStep-flavoured version of the thing I reported here. It suggests the game somewhere has a string where it’s expecing an array or dictionary.
User avatar
Ponder
Dangerous
Dangerous
Posts: 64
Joined: Fri Mar 31, 2006 2:03 pm
Location: Cardiff, UK

Post by Ponder »

I'm not holding my breath but I had a quick try this morning and the crashing problem appears to have been fixed. I'll try properly later when I get home from work.
Image
Post Reply