smcameron / space-nerds-in-space

Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
GNU General Public License v2.0
729 stars 73 forks source link

snis_client crash in show_demon_3d() #286

Closed smcameron closed 2 years ago

smcameron commented 4 years ago

I let snis_server run for a few hours, then connect with a snis_client, then switch to the demon screen, turn on the console, type "find sb-", then close the console, and it crashes. Duplicated this once (connected with another snis_client() and the same thing happened.) Tried a third time, but it didn't crash. In the third attempt, I noticed a strange object where the object type was changing rapidly, so it was rapidly switching between different models. I was not able to select this object. It would appear that there's some memory corruption happening. Not sure if the crash and the rapidly switching object type are related.

I did get this backtrace on the 2nd attempt:

[Current thread is 1 (Thread 0x7f599cd928c0 (LWP 29303))]
(gdb) bt
#0  0x0000000000452f01 in vec3_cwise_max ()
#1  0x00000000004a5be0 in show_demon_3d ()
#2  0x00000000004a8815 in main_da_expose ()
#3  0x00000000004143c6 in main ()
smcameron commented 4 years ago

Using the 2D demon screen, I was able to see where the rapidly changing object was, and select it, and attempt to delete it. However, it actually seemed to be multiple objects. Here's a screen shot:

weird-objects

So whatever it is, it seems to be approximately 20 objects. The location appears to be (0, 0, 0).

Very strange.

smcameron commented 4 years ago

A better backtrace:

[Current thread is 1 (Thread 0x7f8ce74d28c0 (LWP 4350))]
(gdb) bt
#0  0x000000000045a743 in vec3_cwise_max (v=0x98) at quat.c:431
#1  0x0000000000450a2d in entity_get_scale (e=0x0) at entity.c:208
#2  0x00000000004c34e4 in show_demon_3d () at snis_client.c:19623
#3  0x00000000004c4615 in show_demon () at snis_client.c:19869
#4  0x00000000004c7193 in main_da_expose (window=0x3226790) at snis_client.c:20981
#5  0x00000000004cf350 in main (argc=4, argv=0x7ffe1196c5c8) at snis_client.c:23616
...
#2  0x00000000004c34e4 in show_demon_3d () at snis_client.c:19623
19623                           (1.0 - demon_ui.exaggerated_scale) * entity_get_scale(o->entity));
(gdb) print o
$1 = (struct snis_entity *) 0xc874d0 <go+2913840>
(gdb) print o->type
$2 = 27
(gdb) print o->id
$3 = 463632
(gdb) print o->entity
$4 = (struct entity *) 0x0
(gdb) list
19618               break;
19619           case OBJTYPE_FLARE:
19620               e = add_entity(instrumentecx, torpedo_nav_mesh, o->x, o->y, o->z, color);
19621               if (e) {
19622                   update_entity_scale(e,  demon_ui.exaggerated_scale * scale +
19623                           (1.0 - demon_ui.exaggerated_scale) * entity_get_scale(o->entity));
19624                   update_entity_material(e, &yellow_material);
19625               }
19626               break;
19627           case OBJTYPE_SHIP2:
(gdb)
smcameron commented 4 years ago

This should fix the crash:

Not sure about the weird objects at 0, 0, 0, although they seem to be gone now too.

smcameron commented 4 years ago

Ok, the weird objects at (0, 0, 0) are still there. On the 2D demon screen, if you zoom in on "F5" (the very center of the grid) you can see many objects spawning right at (0, 0, 0) but also near (0, 0, 0). They seem to be shortlived, whatever they are.

smcameron commented 3 years ago

Another change that I thought might help with the weird objects at 0,0,0, but didn't: 14c9eaaaa177e724f3e9ac05c5866334879d71fe

smcameron commented 3 years ago

I think this gets rid of the spurious objects at (0, 0, 0) on the 3D demon screen (but there are still some on the 2D demon screen): d417e261365f3a57a728fd449c79e526e2e767ad Initialize all elements of object location and orientation history on client objects

smcameron commented 2 years ago

Haven't seen a crash on the demon screen in a long time. Closing this one.