Memory overflow bug

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

Moderators: winston, another_commander, Getafix

Post Reply
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Memory overflow bug

Post by another_commander »

One quite serious memory overflow bug was squashed today. OXPers should be aware of this, as it is present in the 1.72.2 version.

The memory overrun occurs when a ship dictionary contains the escort-ship key and that key is the same as the key of the dictionary containing it. An example will clarify immediately what I mean.

Let's take a recently developed popular ship, like the Caduceus. To reproduce the bug, open the Caduceus shipdata.plist and in the dictionary residing under the <key>caduceus</key> entry, paste this:

Code: Select all

<key>escort-ship</key>
<string>caduceus</string>
<key>escorts</key>
<integer>2</integer>
The escorts key is optional. If you attempt to add a Caduceus ship by opening the console and typing :spawn caduceus (or if the populator decides to add a Caduceus in the universe), the game will crash with a memory overflow, at least on Windows, as it will try to spawn two escort Caduceus for every one that is generated, including the escorts themshelves.

For now, anyone making ships should be aware of the bug and be very careful when assigning escorts this way. v1.73 will have this already fixed. In v1.73, when something like the above is encountered, the escort setup will be ignored and a warning message will be issued in the log.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

The memory overrun occurs when a ship dictionary contains the escort-ship key and that key is the same as the key of the dictionary containing it. An example will clarify immediately what I mean.
When I understand this well it was less a bug in oolite but more a bug in the oxp itself. I your example the oxp'er is asking for an endless number of ships by defining it being its own escorts. (In our country we call this the "Droste" effect). Something similar wil probably also happen with a escort-role calling its own role.

You now only mention a ship defining itself as escort. But you can also define two (or more) ships that have each other as escort. This setup also asks for adding an endless number of ships. Will your fix also catch this similar oxp bug?

I remember making such a mistake myself. The system froze and the log mentioned it had reached the maximum number of entities. At that moment it was pretty crowded around the witchpoint.
However it never lead to memory overflow with me, just a very slow FPS system I wanted to jump out very quickly.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

You are absolutely correct, Eric. The fix is only partial and covers the escort-ship shipdata.plist case. I took your advice over PM and applied the fix that covers all cases: Escort ships cannot declare escorts of their own anymore. They were never meant to anyway and this covers all cases, including those of mutual escort references between two or more ships.
Post Reply