Cache-bug does cause ships to explode
Moderators: winston, another_commander, Getafix
Cache-bug does cause ships to explode
Hi,
this is really, really strange. Some users were trying to figure out what is wrong with the caduceus so that it always does blow up when it enters a structure like the fuel stations. We tried different changes like removing or modifying subentities until Makara found out the following bug and I can confirm that it does still exist in trunk:
When the game was started with cache force-flushed, the Caduceus does not have any problems.
When the game then is quit and reload without flushing the cache, the Caduceus does blow up.
When the game then again is started with cache force-flushed, the Caduceus again does not have any problems.
Looks like some bad data is written to the cache. At least for my part, trunk was used for the test, but as the problem does exist pretty much since the invention of the neocaduceus several months back, it can be assumed to be spread over several oolite versions.
The requirement to flush the cache for each gaming sessions also explains why testers who usually do not use the caduceus oxp did not see any problems - their addition of that ship did cause a force-flushing of the cache anyway.
Screet
this is really, really strange. Some users were trying to figure out what is wrong with the caduceus so that it always does blow up when it enters a structure like the fuel stations. We tried different changes like removing or modifying subentities until Makara found out the following bug and I can confirm that it does still exist in trunk:
When the game was started with cache force-flushed, the Caduceus does not have any problems.
When the game then is quit and reload without flushing the cache, the Caduceus does blow up.
When the game then again is started with cache force-flushed, the Caduceus again does not have any problems.
Looks like some bad data is written to the cache. At least for my part, trunk was used for the test, but as the problem does exist pretty much since the invention of the neocaduceus several months back, it can be assumed to be spread over several oolite versions.
The requirement to flush the cache for each gaming sessions also explains why testers who usually do not use the caduceus oxp did not see any problems - their addition of that ship did cause a force-flushing of the cache anyway.
Screet
Re: Cache-bug does cause ships to explode
A little extra info from my fiddling around.Screet wrote:When the game was started with cache force-flushed, the Caduceus does not have any problems.
When the game then is quit and reload without flushing the cache, the Caduceus does blow up.
When the game then again is started with cache force-flushed, the Caduceus again does not have any problems.
Was running Oolite 1.73.3 on Windows XP
I was able to quit & reload Oolite with no problems, but at some point the explosion problem reoccurred.
As Screet said, force flushing the cache (I found turning OXPs off & on again works) temporarily solves the problem. The same flight actions can then be performed with no explosion.
A more complete list of what I did is in this thread.
Well, the problem of ships exploding without real cause is known for months, but only to be seen with special ships. Thus the usual understanding was that either the collision detection for such ships or the ships themselves would have a bug. Only when Makara did notice that it's got something to do with flushing the cache it became obvious that the problem is located elsewhere...thus, if you did not notice that part earlier, your report would only have emphasized the need to find this thing without having an idea at where to look.Chrisfs wrote:Here I was thinking it was an ingame thing about the size and shape of the ship and the fuel station. I would have reported it earlier myself.
Question to the devs: Since this appears to be a cache-related problem, can you suggest any parts of the source where people should look at if they want to help to find the cause/a solution?
Screet
Addition to the inial report:
Upon launch I did flush the cache. During the gaming session I did suspend the computer and restarted it later. Oolite had no problem with that. I also was killed once (photon torpedo *ARGH*). The log says that something did cause the cache data to be re-read (most probably me being killed).
After that, the attempt to refuel at a fuel station did again destroy my ship.
Screet
Upon launch I did flush the cache. During the gaming session I did suspend the computer and restarted it later. Oolite had no problem with that. I also was killed once (photon torpedo *ARGH*). The log says that something did cause the cache data to be re-read (most probably me being killed).
After that, the attempt to refuel at a fuel station did again destroy my ship.
Screet
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Oolite test 1.73.4
Win XP Pro 32bit SP3
OXPs:
My ship (has 3 turrets)
Neocaduceus
Fuel Station 1.23
My ship never explodes when entering the Fuel Station if I fly carefully.
Caduceus seems to hit solid wall some 50-70 meters from the station.
I tried a few things to stop the bouncing (with Extra Energy Unit, Shield Boosters and Naval Shield Enhancement the ship doesn't explode, but bounces back if flown slowly enough while trying to enter the Fuel Station):
* checked all .dat files and flipped the normals (invert model in Wings3D) for those which showed inside out when importing to Wings3D - no joy
* altered the subentities' order in shipdata.plist - no joy
* changed the quaternions of cmounts from 0 0 0 0 to 1 0 0 0 - 90% success
I flushed the cache every time I changed any of the files involved.
When I finally got the Caddy to refuel in the Fuel Station, I tested again with my ship (not closing Oolite in the meantime) and then again with Caduceus - explosion.
New test with my ship - got fuel, again with Caduceus - got fuel, close Oolite and restart without flushing the cache - Caduceus got fuel, my ship again - success, Caduceus again - success.
Looks like editing quaternions and careful flying works...
Win XP Pro 32bit SP3
OXPs:
My ship (has 3 turrets)
Neocaduceus
Fuel Station 1.23
My ship never explodes when entering the Fuel Station if I fly carefully.
Caduceus seems to hit solid wall some 50-70 meters from the station.
I tried a few things to stop the bouncing (with Extra Energy Unit, Shield Boosters and Naval Shield Enhancement the ship doesn't explode, but bounces back if flown slowly enough while trying to enter the Fuel Station):
* checked all .dat files and flipped the normals (invert model in Wings3D) for those which showed inside out when importing to Wings3D - no joy
* altered the subentities' order in shipdata.plist - no joy
* changed the quaternions of cmounts from 0 0 0 0 to 1 0 0 0 - 90% success
I flushed the cache every time I changed any of the files involved.
When I finally got the Caddy to refuel in the Fuel Station, I tested again with my ship (not closing Oolite in the meantime) and then again with Caduceus - explosion.
New test with my ship - got fuel, again with Caduceus - got fuel, close Oolite and restart without flushing the cache - Caduceus got fuel, my ship again - success, Caduceus again - success.
Looks like editing quaternions and careful flying works...
...and keep it under lightspeed!
Friendliest Meteor Police that side of Riedquat
Far Arm ships
Z-ships
Baakili Far Trader
Tin of SPAM
Friendliest Meteor Police that side of Riedquat
Far Arm ships
Z-ships
Baakili Far Trader
Tin of SPAM
Yes, I did also change the quaternions accordingly, as I wrote in the Caduceus thread. Flushing the cache every time, I did not yet get a problem unless I got killed (and I also did suspend the machine that time). However, Multiple loading without flushing seemed to produce problems, but not necessarily upon the first session without flushing the cache?!?Zieman wrote:* changed the quaternions of cmounts from 0 0 0 0 to 1 0 0 0 - 90% success
Looks like editing quaternions and careful flying works...
That it's not bad flying which blows up the ship becomes clear when I switch to outside view. If it does blow up, it's not having any contact and at most the very tiny head of the ship comes close to the station. If I can fly in, I can also fly comfortably through the sides of the station...
Furthermore, if I do flush the cache every time, it seems like it's much harder for NPCs to hit me - but maybe I'm just lucky? I've flown the Caduceus multiple times between the beams of a wolf without being hit (and subsequently shot both of the wolfs laser mounts, really, whoever made that possible - the ship is so weak for NPCs!).
It reminds me, somehow, of the bug that was there some months back with wreckages: They grew larger and larger and without flushing the cache the increased amount was also used upon the next oolite launch...could that be the problem of the Caduceus and other ships, something that does increase their collision size over time?
Screet
Quaternions shouldn't be 0 0 0 0 . They should always normalise to 1 (root of the sum of the squares of all 4 values), so 0 0 0 0 isn't a valid quaternion (the unit is 1 0 0 0).
May or may not be relevant to this, but just a comment. And in my experience any ship which explodes in a station will bounce off it instead if you fly very slowly (one or two pixel-widths of speed on the gauge).
May or may not be relevant to this, but just a comment. And in my experience any ship which explodes in a station will bounce off it instead if you fly very slowly (one or two pixel-widths of speed on the gauge).
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
More testing (no cache flush):
1st try with Caduceus succesful
next try (jump to new system, try to get fuel) - KABOOM
load save, new try - explosion
load save, dock at main station first, then to Fuel Station - BOOM
next 5 tries with Caduceus all fail
then I refueled my ship in Fuel Stations (hopping between 2 systems and refueling) 6 times in a row - no problems
new try with Caduceus - explosion
new try, refuel at Fuel Satellite first - explosion when trying to enter Fuel Station
SO, my initial testing gave a false positive ...
Looks like the Fuel Station and Caduceus don't like each other, and I can't figure out any reason for it. Maybe it is the cache thing then.
1st try with Caduceus succesful
next try (jump to new system, try to get fuel) - KABOOM
load save, new try - explosion
load save, dock at main station first, then to Fuel Station - BOOM
next 5 tries with Caduceus all fail
then I refueled my ship in Fuel Stations (hopping between 2 systems and refueling) 6 times in a row - no problems
new try with Caduceus - explosion
new try, refuel at Fuel Satellite first - explosion when trying to enter Fuel Station
SO, my initial testing gave a false positive ...
Looks like the Fuel Station and Caduceus don't like each other, and I can't figure out any reason for it. Maybe it is the cache thing then.
...and keep it under lightspeed!
Friendliest Meteor Police that side of Riedquat
Far Arm ships
Z-ships
Baakili Far Trader
Tin of SPAM
Friendliest Meteor Police that side of Riedquat
Far Arm ships
Z-ships
Baakili Far Trader
Tin of SPAM
Yeah - if you check out the Caduceus thread you'll see the things tried so far that has narrowed it down to something up with the cache.
I like Screet's expanding subentity idea. I still have the separate engine subentities on my version of the Caddy. And when I have looked at it from an external view the explosion seems to occur just at the instant the Caduceus enters the fuel station cylinder (i.e. breaks the plane defined by the extreme ends of the station).
Of course, this doesn't explain why the Caduceus is affected and not the Imperial Courier - they both have rotating engine subentities. The only real difference I can see between the two is that the Courier has weapons on its pods, and the Caduceus has shaders on its.
I like Screet's expanding subentity idea. I still have the separate engine subentities on my version of the Caddy. And when I have looked at it from an external view the explosion seems to occur just at the instant the Caduceus enters the fuel station cylinder (i.e. breaks the plane defined by the extreme ends of the station).
Good point. Even approaching at the lowest possible speed causes an instant explosion. Possibly the (expanded) subentity impacts and this affects the whole ship?Thargoid wrote:And in my experience any ship which explodes in a station will bounce off it instead if you fly very slowly (one or two pixel-widths of speed on the gauge).
Of course, this doesn't explain why the Caduceus is affected and not the Imperial Courier - they both have rotating engine subentities. The only real difference I can see between the two is that the Courier has weapons on its pods, and the Caduceus has shaders on its.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Incorrect. It is not a cache bug, but a ship bug. Some subentities are not defined correctly. A quaternion must be normalised. This means (a^2 + b^2 + c^2 + d^2 ) must be one. If it is not normalised, oolite divides the four numbers by this value after reading in.Makara wrote:Yeah - if you check out the Caduceus thread you'll see the things tried so far that has narrowed it down to something up with the cache.
However, for three subentities the quaternion is defined as (0,0,0,0). This is invalid and can't be normalised. Probably oolite has a backup mechanism that this wrong entry defaults to the (1,0,0,0) when reading in the data, but not when reading the cache. When you open the cache with a plist editor, than open the ship registry key and look for the caduceus alpha, you see that these subentities are stored with a quaternion NaN (not a number)
Simply changing the quaternions into a valid quaternion fixes the bug in my test. I just don't understand when everybody says that the subentities are to blame and it is probably a rotation problem that nobody did look at the subentity definition..
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Please read properly. In the Caduceus thread we discussed that changing the quartnerion does help after flushing the cache, but after a few flights the Caduceus does explode again!Eric Walch wrote:Incorrect. It is not a cache bug, but a ship bug.
However, for three subentities the quaternion is defined as (0,0,0,0).
Furthermore, if incorrect Quarternions are used, Oolite does have to write an error log for that, which is missing. Should I write an additional bug report for that?
Screet
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
No need. I added it now. My log now reads:Screet wrote:Furthermore, if incorrect Quarternions are used, Oolite does have to write an error log for that, which is missing. Should I write an additional bug report for that?
Screet
Code: Select all
[shipData.load.begin] OOShipRegistry.m:278: Loading ship data...
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-omega-player has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-omega-player has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-omega-player has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-alpha-player has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-alpha-player has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-alpha-player has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-omega has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-omega has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-omega has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-alpha has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-alpha has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[shipData.load.error] OOShipRegistry.m:1148: ***** ERROR: The ship caduceus-alpha has a wrongly defined orientation for its cmount subentity. Setting it now at (1,0,0,0)
[script.load.world.listAll] ResourceManager.m:893: Loaded 39 world scripts: "aquatics_equipment" 1.1, "aquatics_populator" 1.0, "AsteroidStorm" 3.54, "behemoth" 2.5.3, "bigShips_populator" 1.0.2, "buoyRepair" 1.02.5, "Cargo_Wreck_Teaser" 1.5.3,
EDIT: added logging in revision 2716
Last edited by Eric Walch on Wed Oct 28, 2009 12:03 pm, edited 2 times in total.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
If you've got the time, after fixing the cmount file and flushing the cache, please crash the caduceus a few times, then quit oolite and restart it...at least after a few restarts, the problem does come back for me (crashing with fuel stations).Eric Walch wrote:This ship also seemed to be the only one with this bug among all my installed ships.
The Kirin also has the same problem with fuel stations - and it's surely not the fuel stations model (as cataclysm hive, modified trade outpost, black monk monasteries and such also explode the ships).
Thus, since it's coming back even with a fixed cmount after some time and does go away after flushing the cache, it's IMHO the caching to look at.
I do wonder if it would be simple to expand the current cache verification mechanism: what's written in there to be checked against a fresh loaded file...and if there's difference, that surely would help to locate the source of the problem.
Screet