The infamous 'objects disappearing bug'

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Gadget2006

The infamous 'objects disappearing bug'

Post by Gadget2006 »

I've been following the changes in Exult for quite a while and a couple months ago I saw the announcement on the front page saying that there's a serious game-breaking bug with objects disappearing that is very difficult to track in the code and fix. I've been regularly looking into CVS changelog since then but the last modification to the code was made in early March 2011 (and so was the latest binary snapshot) - I hope the code base is still being worked on and three months of no CVS activity relevant to Exult modifications and snapshots doesn't mean Exult is going to die away...

At any rate, since Exult currently contains a serious, potentially game-breaking bug that might just appear for no apparent reason and screw up my game, I'd like to ask if you have information on which earlier CVS snapshots have been known not to have this bug. I have earlier pre-1.4.9rc1 snapshot downloads since early February 2010 until March 2011 (pretty much monthly or so) and I'm wondering what would be a rather safe bet to just play through Ultima 7 with Exult without having to downgrade all the way to 1.2 - so that perhaps I'll play without the latest 1.4.9rc1 changes but will not get the 'objects disappearing' bug either. Does anyone know?.. Thank you very much in advance for your response.

And by the way, were there any advances in tracking down the objects disappearing bug (assuming that it was being worked on since March 2011)?.. That's one thing that I'd indeed love to see fixed, as otherwise Exult is just the perfect engine to play through U7.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

We have no idea what broke the engine and when. Since there is no sure way to reproduce the problem we can't pinpoint it.
We have some idea what the general problem might be, but right now, people need a break before getting back into fixing Exult.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Gadget2006

Re: The infamous 'objects disappearing bug'

Post by Gadget2006 »

OK, thanks for your response, I'm glad to hear you guys didn't give up on Exult! Have a nice rest from coding and good luck in your future endeavors in fixing the game when you get back to it! I guess I'll give a random old mid-2010 snapshot a try and see if I can beat the game with that. :)
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

I wouldn't recommend that, actually. The bug is most likely not a recent one, the first report in the bug tracker was from 2009, so the bug is probably even from 2008 or earlier.
AND we made other changes and fixed stuff as well, so running the latest snapshot and saving often is what I'd recommend.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Gadget2006

Re: The infamous 'objects disappearing bug'

Post by Gadget2006 »

Oh OK, that's strange - I'm pretty much I beat the game back in 2008 and 2009 using SVN snapshots and never experienced such an error, guess I was lucky then. :) OK, then I'll try it with the latest snapshot and will just make lots of saves just in case. :)

Is there any way to pinpoint this bug early on when it happened before it gets "too late"? (I mean, is it apparent immediately that something is up? Or can it be just a random thing disappearing somewhere without me noticing it only to bite me in the butt some 2-3 hours later when I realize that all the saves I made since then went bye-bye?)
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

I'm not sure :)
The one time it happened for me it was apparent, since some objects just disappeared around me but I can't say that this always happens in this way...
Also in my case the problem occurred when I was already playing for a long time in one go (meaning since starting Exult), so that might be related.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Gadget2006

Re: The infamous 'objects disappearing bug'

Post by Gadget2006 »

Oh OK, thanks for the info. :) I'll let you know if any instances of this bug manifest themselves during my playthrough.
VisElEchNon
Posts: 59
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by VisElEchNon »

Just out of curiosity, could the bug be the same one as noted in this article from 1992?
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

Exult is NOT Ultima 7.
Exult doesn't use Ultima 7s code.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
VisElEchNon
Posts: 59
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by VisElEchNon »

Okay, I was just curious...
Zosite
Posts: 101
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Zosite »

Hehehe... as Dominus explains (he made it clear to me too some time ago) Exult doesn't use the original code hence why this particular bug can't be that annoying original one we all suffered back in the day.

However, that article forgets to mention how funny was whenever you noticed that your stuff didn't disappear but it was actually STOLEN by somebody.

I just cannot remember how many times Nicodemus stole reagents from my backpack. And what about the barman at Vesper? (cant' remember the name). I was always checking my stuff right after talking with a few -nice- fellas. uO_o
-Zósite K.S. from Moonlightshadow-
Mortegro

Re: The infamous 'objects disappearing bug'

Post by Mortegro »

Just have to ask... objects disappearing for good? I know no one know what bug is triggering it. But i want to know if this happens only if the Avatar has contact with it? Could objects dispear on there own? In spots that the Avatar haven't explored yet?

Anyway... i hope you guys find this bug.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

Yes, objects disappearing for good, no way to reproduce and no idea whether it happens only around the avatar or further away, too. We wrote about it on our front page some months ago.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Scythifuge
Posts: 384
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Scythifuge »

Did this bug happen to occur around the time that the lift was raised to, I think it was a value of 255?
bradsucks

Re: The infamous 'objects disappearing bug'

Post by bradsucks »

Any thought of making a heavily logged version of Exult to try and track the bug down? I'm itching to do a playthrough and have been holding off for like a decade. I'd feel very noble if I thought I was actually helping while I played it.
Luke

Re: The infamous 'objects disappearing bug'

Post by Luke »

Semi-related, can the cheat options track down an object and give the in world location to see if it has succumbed to the bug or that I simply misplaced it... *embarrassed grin*

Can't find the talisman from the FOV test of truth....
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

Nope, can't do that
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Muzza

Re: The infamous 'objects disappearing bug'

Post by Muzza »

This may seem like a stupid question but,

Did origin not already fix the bug that causes things to disappear? Could it be that some people are using the unpatched original version of Ultima 7 BG?

Upon installing my copy of Ultima 7, from the Ultima Collection CD, i found a zip with a patch to update Ultima 7 to version 1.1..

The beggining of the patch batch file says:

@echo off
echo ***********************************************
echo * Ultima VII - The Black Gate update program *
echo * Ver 1.1 (C) 1992 Origin Inc. *
echo * Problem: Once in a great while, items or *
echo * terrain disappear or are altered. Keys are *
echo * removed from party inventory while sleeping.*
echo ***********************************************

The patch zip contents are:
KZ.EXE 32KB
U7.KZ 303KB
UPDATEU7.BAT 2KB
XXX.EXE 11KB

I can't figure out if this patch is already applied to the copy on the Ultima Collection CD im using as it won't let me patch on my 64-bit system.

I imagine this is a long shot, but I thought it odd that this patch is not mentioned in the FAQ and i cannot search it anywhere else in the forum. I would guess that there would be a large variation in the versions/sources of Ultima 7 installs that people are using with Exult.

So is it possible that people are using unpatched buggy copies of Ultima 7 with Exult rather than Exult causing Ultima 7 to be buggy?
Muzza

Re: The infamous 'objects disappearing bug'

Post by Muzza »

Nevermind that last post - just read that none of Exult is origial code.
Anonymous

Re: The infamous 'objects disappearing bug'

Post by Anonymous »

It happened to me today. Here's a summary of what happened:

I was in New Magincia with a party composed of Avatar, Iolo, Spark, Shamino, Sentri and Jaana. I noticed Katrina out (it was around 9 PM), near that small house in the center of the island, and stuck in the position the characters have when they're going to sit down or vomit. I talked to her a bit, then I saved; a bit after saving Exult hung, so I restarted it and loaded the game. Jaana was not in the party anymore; the join command on her did nothing to solve this. I managed to add her to the party by using the cheats menu, toggling the party switch in the NPC stuff twice. I noticed the clock was off and had approximately the same time as the next-to-last save (11 AM), furthermore the notes I did disappeared, so I teleported to Cove, then Vesper to make sure the sub-quests I completed since then save were still counted completed. In Cove they weren't, but the real surprise was to be found in Vesper: almost every piece of furniture in the Gargoyle part of the town (including doors, tables etc.) had disappeared.

I'm using Exult v1.4.9rc1 compiled from the sources.
paulo

Re: The infamous 'objects disappearing bug'

Post by paulo »

Is exult tested with valgrind?
paulo

Re: The infamous 'objects disappearing bug'

Post by paulo »

Slow as god's wrath.

==15765== LEAK SUMMARY:
==15765== definitely lost: 291,170 bytes in 715 blocks
==15765== indirectly lost: 2,743,988 bytes in 27,922 blocks
==15765== possibly lost: 139,348 bytes in 1,447 blocks
==15765== still reachable: 132,219 bytes in 2,217 blocks
==15765== suppressed: 0 bytes in 0 blocks
==15765== Reachable blocks (those to which a pointer was found) are not shown.
==15765== To see them, rerun with: --leak-check=full --show-reachable=yes
==15765==
==15765== For counts of detected and suppressed errors, rerun with: -v
==15765== Use --track-origins=yes to see where uninitialised values come from
==15765== ERROR SUMMARY: 218 errors from 218 contexts (suppressed: 1402 from 7)


Anyway, gonna log a while.
paulo

Re: The infamous 'objects disappearing bug'

Post by paulo »

Ok here is a simple log just from walking around. Most lost memory seems to be from subclass overriding? No invalid accesses yet.

Anyway, here is a cut down log with:
cat leaks.txt | grep -A 2 -i invalid; cat leaks.txt | grep -A 2 -i indirectly ;cat leaks.txt | grep -A 2 -i definitely > leakssimple.txt


http://pastebin.com/awPCiQJt

(the complete thing is bigger than the file limit on paste bin)
paulo

Re: The infamous 'objects disappearing bug'

Post by paulo »

Wrong concat operator and stuff.

cat leaks.txt | grep -A 2 -i invalid >> leakssimple.txt; cat leaks.txt | grep -A 2 -i indirectly >> leakssimple.txt ;cat leaks.txt | grep -A 2 -i definitely >> leakssimple.txt



http://pastebin.com/raw.php?i=4DS8yMEi
kaizoku

Re: The infamous 'objects disappearing bug'

Post by kaizoku »

To keep my message short: I haven't tried Exult myself but I found the following message regarding the cause of this issue:
At http://rpgcodex.net/phpBB/viewtopic.php?t=62655


It says:
Solution to Ultima VII BG freezes found(?)

Exult 1.4.9rc1: played U7 SI without freezing problems, then played U7 BG with freezes every now and then.
I noticed how many items are spawned by NPCs doing jobs like baking, sewing, waiting on tables. There are lots of shears and dining plates generated on one location. Britain it self has 5 NPCs doing this, and almost every town has a tavern keeper generating food and dining plates.

Now, the freezing in U7 BG is known to be accompanied by loss of items, so I decided to disable or change the NPCs behaviour using the cheat menu and altering their NPC schedules, I also deleted some crafting equipment like tables. This way they cannot generate items. I decided to be on the safe side and delete useless items lying around.

Starting a new game and doing this, there is so far no more freezing. I'm guessing that it is due to the crafters or the items generated. Try this and see if it works for you, remember to delete the excess generated items.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

It's a work around and not the solution...
See http://exult.info/forum/viewtopic.php?p=362775#p362775
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Colourless
Site Admin
Posts: 731
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Colourless »

With this information it may be possible to actually track down whats gone wrong.
BeagleBoy
Posts: 5
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by BeagleBoy »

Out of curiosity, does anyone have a rough idea of when this bug started to manifest?

I ask, because I recall playing and winning both BG and SI with exult in the past, but I admit it's been quite a while. So I was wondering if I had just been lucky when I played, or if the bug was introduced (or became more prevalent) since my last time playing.

Basically, I've got the urge to play U7 again. So I can play under dosbox (okay, but sound isn't perfect), play under my old copy of Exult (not perfect, but it was certainly playable), or download the latest copy. If my copy from 3 years ago was just as likely to have the bug hit, then I won't worry too much about using a new copy. Otherwise, I'll probably stick with the old copy.

I suppose my other option would be to break out the debugger and try to help solve the problem. But between coding all day at work, and changing kids' diapers at home, I'd kinda like to just play a game in the evening. ;)

-Jim
Colourless
Site Admin
Posts: 731
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Colourless »

Don't think anyone has looked into it yet. An idea might be to run it through valgrind and just leave it sitting in britain in the pub and just wait and see what happens.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

Marzo and I talked a bit about what *could* be done http://log.usecode.org/exultlog.php?log=25Aug2011
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by agentorangeguy »

I've had some issues with entire u7ireg files being 'blanked' back to 512bytes or whatever. luckily I keep backups of the gamedat folder so I can replace the 'blanked' ones. I did notice the Blue Boar had some food stocking up on the plates, so I created a usecode egg to delete the excess food in a certain area when you pass by, that way it doesn't get piled up. Here it is, if anyone wants to use it as a temporary fix like I did. Works nicely!:

Code: Select all

void RemoveFoodBlueBoar ####() //# is number of egg 
{

	if (event == EGG)
	{
	pos1 = [0x418, 0x4ea]; //top left corner of rectangle - hex coords
	pos2 = [0x4c9, 0x4fb]; //bottom right corner of rectangle -hex coords
	var food = UI_find_object(-359, SHAPE_FOOD, -359, FRAME_ANY); 
	//all individual food frames, so everything gets deleted
	UI_remove_from_area(SHAPE_FOOD, 0, [pos1], [pos2]); 
	UI_remove_from_area(SHAPE_FOOD, 1, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 2, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 3, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 4, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 5, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 6, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 7, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 8, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 9, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 10, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 11, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 12, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 13, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 14, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 15, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 16, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 17, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 18, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 19, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 20, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 21, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 22, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 23, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 24, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 25, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 26, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 27, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 28, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 29, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 30, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 31, [pos1], [pos2]);
	UI_remove_from_area(SHAPE_FOOD, 32, [pos1], [pos2]);


	}
}
(edit by Dominus: corrected pos2 as Agent wrote in the following post)
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by agentorangeguy »

whoops, for 'pos2' it is the BOTTOM RIGHT corner of the rectangle.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

I'm not sure this helps to much, as far as I think the bug works it is regardless whether the Aavatar is near.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by agentorangeguy »

yeah, I've had random areas wiped clean for no apparent reason. the egg I made at least makes things better for the eyes, it sucks seeing piles and piles of food on someone's plate haha
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

yeah, I thought Malignant added some code to make the pubs a bit cleaner to SVN.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

Btw. I'd pay for someone to fix that damn disappearing objects bug :)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
1crash007
Posts: 10
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by 1crash007 »

Just out of mere curiosity what if someone tried something like this:

create a random party of 2 standard characters and two npcs

give each a backpack with 10 coins.. some food two pieces and a random
item (hammer pickaxe sword blank.... etc)

Create a business schedule for each of them in different locations
then teleport yourself around a few times allow some days to pass time..
find a trigger of a quest or something...

then go and recall all party and npcs and check there inventory..
if they gained items then maybe they are from activating them when they were walking off screen..

If items disappeared then track from there..

Also when the backpack issue was fixed a while back did the bugs occur before? (bug about items going outside backpack grab limit)
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

The bug is not about items disappearing from the inventory, it's about whole areas being wiped to the bare chunk (in the worst case).
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
N

Re: The infamous 'objects disappearing bug'

Post by N »

Hey,

Could you guys put out a general statement about what sorts of savefiles/help could be good from us non-coders?

I'm sure that we'd love to help you solve this -- so just tell us if you can think of anything useful. (ie. Savefiles with missing objects -- I think that the drawbridge to castle Britannia disappeared in one of my games...)

If that isn't useful, then let us know what we can provide to render assistance.

Cheers!

-N
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

Right now no user help is needed. Right now it needs a developer/programmer to tackle it.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Hammerite

Re: The infamous 'objects disappearing bug'

Post by Hammerite »

I have the very same thing happen... Haven't played U7 for sometime, download the latest Exult.exe played a few hours and noticed something funky. All the furnitures and item disappeared from the houses.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by Dominus »

Then don't play further with this savegame, playing on with this will not get better. Revert to one where the furniture is not yet gone. Save often and often reload, or restart Exult.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by drcode »

I'd like to work on this, but I have no idea how to make the bug happen. I think it might have occurred years ago for me when I was in Britain, and it does seem to have something to do with being in an area with lots of objects. It also might have to do with the 'cache-out' code, which happens when you walk away from an area. The objects there are supposed to be stored in a separate buffer, then restored when you walk back.

I tried using the 'cheat' screen to insert loads of extra objects by the Avatar, then walk away and back; but nothing went wrong. Anyone have a savegame where they could reproduce the problem?
paulo

Re: The infamous 'objects disappearing bug'

Post by paulo »

Can you limit given allowed memory to a linux program?
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by marzo »

DrCode: I am just about 100% sure that the disappearing objects bug is due to double deletion -- several schedules hold live pointers to their temporary objects that may be deleted due to a cache out; and the schedules also delete these objects once they end (for example, due to a cache out). I doubt this happens only in schedules, but I am sure it happens in them. I had begun some work on using smart pointers (the fork I made) for objects (instead of raw pointers), but unfortunately I haven't had much time to work on it.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
paulo

Re: The infamous 'objects disappearing bug'

Post by paulo »

Is smart pointers the equivalent of WeakReferences in garbage collected languages?
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by marzo »

There are "weak" and "strong" smart pointers; so in a sense, yes and no.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by drcode »

Marzo: That makes a lot of sense. But it looks like everything gets deleted in cache-out and the schedules by a call to 'remove_this(0)', which puts the object in gwin's 'removed' list, which is a 'map' that should avoid having the same item there twice.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by marzo »

Consider this case: the NPC in a schedule places an item in the map. He then moves to a different chunk (because the schedule takes place near a chunk's edge). The player moves away, caching out the chunk where the object was placed (deleting the object) but -- and this is crucial -- not the NPC.

That alone would be dangerous: the schedule keeps a live pointer to the object and may cause problems if the NPC tries to do something with that pointer. But to make things worse, any of these cases may happen:

[*] A change of schedule causes ::ending to be called, which tries to delete the object;
[*] in the course of the schedule, the schedule tries to delete the object as part of the normal course of operations;
[*] the player moves further away and triggers the cache-out of the chunk where the NPC is in; this causes ::ending, causing the object to be deleted.

Since the chunk where the object was has already cached out, the object has already been deleted and will no longer be in the 'removed' list. Thus, the second attempt to delete the item will go through, resulting in the double delete.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
VisElEchNon
Posts: 59
Joined: Thu May 14, 2020 1:34 pm

Re: The infamous 'objects disappearing bug'

Post by VisElEchNon »

In this case wouldn't it be "relatively easy"* to test this by creating a test NPC with a schedule similar to what you've described?

* Yeah, I know, nothing is ever as easy as it sounds where programming is concerned.
Locked