Jump to content
  • entry
    1
  • comments
    10
  • views
    920

What is a "stack dump" and what does it mean for my game.


WaxenFigure

1,887 views

There seems to be a lot of inaccurate information going around about what a "Stack Dump" is, what it means and what can be done to avoid them.

Short explanation:

 

A stack dump is what is written to the Papyrus log file whenever the "stack" used by the game to track all the actively running scripts is full and no additional scripts can be run.

 

It is an occurrence that means your game didn't do something or multiple somethings it should have done at the time they were expected to occur and as a result your game should be considered unstable and in an unknown state or more directly, toasted. You cannot rely on anything past the point of a stack dump because you cannot know what did not occur and what the failure means for your game. You can load a save from before the Stack Dump occurred and try to avoid repeating the situation that caused the stack dump to occur.

How do I prevent Stack Dumps from happening?

The worst thing about Stack Dumps is that the game gives no indication other than perhaps a stutter or FPS loss that one occurred, without examining your Papyrus Log to hunt for a Stack Dump you may be unaware they occurred and if you don't have Papyrus logging turned on you can't even use the log to know if one occurred.

What you can do to prevent Stack Dumps from happening is not run the sort of mods which are known to cause them.

Long Explanation:

 

What is a Stack Dump?
A stack dump occurs when there are so many scripts actively running at once that the "stack" used to keep track of them overflows.
In simpler terms it means when the game went to start another script or script instance there was no room in the list used by the game to track those scripts so the script was not run. Until a running script ends all requests for new scripts to start will also cause additional stack dumps occurrences to be logged increasing the overhead in the game and therefore making it less likely a script will be given time by the game to finish.

What does having a Stack Dump occur in my game mean for that game?

 

A Stack Dump caused by one mod can cause a script or multiple scripts that should have run for the mod causing the Stack Dump, other mods or the standard game to not get run causing problems in those other mods or the game because they expect the script to have performed some action(s) that didn't occur. The exact problems caused by any given Stack Dump are highly dependent on what scripts did not get run but the log only tells you what scripts were running, not which script(s) did not run.

 

That means some script which was intended to run and perform some action didn't run when expected, the game does seem to keep track of what scripts did not run and will eventually run the skipped scripts but by the time the script is finally allowed to run it may be far too late. Often that can have no noticeable effect on the game because there are a multitude of scripts running that do very little of note so if they don't run you may not notice. However if it was a critical script for the game or a mod that didn't run and update a quest you can have unexpected breakage of that quest, and often that won't show up for a while.

 

By that action (script not running) Stack Dumps therefore create situations that look like bugs in the game and in mods.

 

There is no notification in game that a stack dump has occurred which makes this more problematic as well since most people have no idea anything bad happened and therefore they play on oblivious to the damage instead of jumping back to their last save and avoiding the problem.

 

Early after the release of Skyrim the most common cause of stack dumps was using the "RegisterForUpdate" call with a very short interval so any time the script took longer to complete than the interval to the next update you'd get a cascade where more and more of the events would get started but because of the number of them all trying to accomplish their task even more of them would not complete until the game completely overloaded.  That was fixed by people switching to using the RegisterForSingleUpdate call instead where the update processing code would simply call for the next update as the last thing to be done before exiting so there would never be more than one outstanding call.

 

Currently the most common cause for stack dumps is the use of "Cloaking spells". The documentation for the CK shows how to create and use cloaking spells as a way of dynamically attaching a script to NPCs without having to mod every NPC in the game to have that script available and a great many mod authors have used that technique in their mods. A cloaking spell is essentially an area effect spell (usually hidden) which is cast in a circle around the target (usually the player) that attaches a script to everything that the spell is designed to effect which is usually NPCs but can be any kind of object. The problem with cloaking spells is that there is a unique instance of that script attached to each item selected by the cloaking spell so the more objects or NPCs selected the more likely it is you'll bump into a Stack Dump situation.

 

Now add several mods which all perform cloaking spells continuously some even performing multiple cloaking spells at once (Beeing Female for example) and you have a greatly increased chance of having a Stack Dump occur. Now add a mod or two like the Populated Cities mod which adds a lot more NPCs to areas and combine that with mods performing cloaking spells on NPCs and once again you've really increased the likelihood you'll get them.

 

I researched stack dumps extensively when I came across them several years ago caused by the Sexlab Submit mod. It used cloaking spells to select NPCs around the player but didn't use any of the options provided to limit the selected NPCs to just those wanted. For instance it has a feature to have any guard seeing you having sex in public interrupt you. But instead of casting the cloak spell on just guards and limiting it further to guards that were in a position where they could see you it cast the spell on all NPCs and then threw out those who weren't guards and then checked of they could see you. Worse yet, that was an optional feature but the check to see of the option was enabled was also made in the script running on each NPC instead of in the script that triggered the spell in the first place so whether you enabled that option or not the spell was always running (it also always ran whether you were having sex or not). Needless to say, it triggered a lot of stack dumps.

 

The original Sexlab Aroused mod also used a cloaking spell, the replacement of that cloaking spell in the Sexlab Aroused Redux mod made a huge improvement in the performance of that mod and removed it from the list of mods which frequently cause stack dumps.

 

What was done in Sexlab Aroused was the cloaking spell was replaced by a silent Quest which can be used to fill quest aliases on that quest but only one script instance is generated which then iterates through all the selected NPCs or items.

 

Now there is also some confusion about what is or is not a stack dump, if a script errors out it will show the stack for that single script but that is not a stack dump. A stack dump is an action where the game dumps the stack of all the running scripts into the log at once and will repeat that entire dump sequence for every single script that fails to start so if a cloaking spell were to select twenty NPCs but there was only room on the stack for fifteen additional script instances you would see five entire stack dumps getting logged (one for each script instance that didn't run at that time because of the lack of resources) which can cause the log to balloon to enormous sizes in a hurry.

 

When you see a stack dump in your log, find the first occurrence and were it starts and ends then look to see what script or scripts are listed in the dump most often, the mods those scripts belong to are your problem mods. Once you know what mods are causing the problem you can decide what to do with them individually, sometimes the mod isn't really important and you can eliminate it, sometimes the option of that mod causing the stack dump can be turned off because it's not a vital part of the mod and sometimes you have to give up a mod that sounds fun but is just a quick trip to an unstable and unplayable game.

 

 

 

I hope this explains why you got this problem and how you can fix or avoid it.

Note: Previously I thought that those scripts that didn't run would never get run but it has been pointed out that the game does seem to manage to queue them and will eventually run them if it ever gets the chance to catch up.  That still makes the game unstable and can cause timing window issues and induce what look like bugs into mods that would have functioned perfectly except for the interference of the mod causing the stack dumps.
 

10 Comments


Recommended Comments

Good stuff, I did some looking into it back when the Original SLA was becoming a beast of burden, and found mostly the same info.

 

The cloaking spell's being one of the main influences for me.  That caused instability. Some mod's that I know are popular and will not mention do this a lot, and give no ability to tone down how often or turn off the cloak, and they indeed cause problems when ran with to many other mods that require or also use cloak's or intensive Event checking.

 

Line of sight, and limiting what they search for would be good if all modders incorporated that, but many do not.

 

  Probably one of the main reasons I run many mods alone in there own profile away from other mods even though quite often the Author of a mod will recommend other mods that would enhance there mod I quite often add those other mods very sparingly if at all.

Link to comment

All the things explained in this blog are totally false.

I request to the autor of this blog to correct their words or delete the entire blog.

 

 

The Stack Dumps are totally harmless. Is a simple warning from the Script Engine for alert of one stress situation.

That not cause any problem to the game, the quest or the scripts.

I have discused this in a lot of post and publish specific mods for demostrate it.

The Stacks Dumps are written to the log, at maximum, one time per minute.

 

If any user, really, have interest on this can read my post, download my tools and make their own test:

https://www.loverslab.com/topic/116910-tool-stack-dump-checker/?tab=comments#comment-2528092

https://www.loverslab.com/topic/119744-random-crashes-stability-and-reliability-of-the-game/

https://www.loverslab.com/topic/119744-random-crashes-stability-and-reliability-of-the-game/?tab=comments#comment-2576958

https://www.loverslab.com/blogs/blog/1133-script-intensive-heavy-really/

https://www.loverslab.com/files/file/8236-script-test/

https://www.loverslab.com/files/file/8779-multi_cloak_counter/

 

Link to comment

being sure to disable the xpmse cloak effect in mcm is a great way to help avoid overloading papyrus threads first thing i do every new save.

 

i'm trying to find a way to say GenioMaestro is dumb without being mean but i don't think i can.

 

they ain't wrong that the dump itself isn't harmful. but that's like saying your aches after getting the flu are harmless.

 

i will agree that having an entire blog called "papyrus stack dumps" for one post is a bit silly though.

Link to comment

As near as I can tell he's actually right that my position that stack dumps cause scripts to not get run is incorrect and that they do get run eventually.  However when the stack dumps take your FPS to 1 or 2 the game is still unplayable which means there's still no excuse to use bad ideas like cloaking spells when completely viable alternatives are available which also have the benefit of being less overhead.

Link to comment

Then, you must correct your blog.

 

But the scripts are not executed eventually. The game always execute all the scripts, no mater how overcharged are the game. Simply need time for execute it.

 

Aditionaly, the Stacks Dumps never can drop the FPS to 1 or 2 because the game only can generate one Stack Dump per minute. You can have a small freeze while the Stacks Dump is generated but after that the game run normally for at least one minute.

 

The problem is never caused by the Cloacks Spells. Is caused by bad developed mods with bad conditions and bad scripts. 

Link to comment
38 minutes ago, GenioMaestro said:

Then, you must correct your blog.

 

Eventually.  Doesn't get much traffic though, never did.


 

39 minutes ago, GenioMaestro said:

But the scripts are not executed eventually. The game always execute all the scripts, no mater how overcharged are the game. Simply need time for execute it.

 

 

I used different words than you did but I said the same thing.  Your statement there simply contradicts itself.

 

41 minutes ago, GenioMaestro said:

Aditionaly, the Stacks Dumps never can drop the FPS to 1 or 2 because the game only can generate one Stack Dump per minute. You can have a small freeze while the Stacks Dump is generated but after that the game run normally for at least one minute.

 

The game only takes one stack dump per minute if it takes a whole minute to make a stack dump, you should say that the game only takes one stack dump per Frame.

 

43 minutes ago, GenioMaestro said:

The problem is never caused by the Cloacks Spells. Is caused by bad developed mods with bad conditions and bad scripts. 

 

Cloaking spells are the number one reason for Stack Dumps.  Bad conditions make them far more likely. Bad design (using cloaking spells instead of Quest Aliases) is the source of the problem.  The point of the BLOG is to help people know what IS a bad design so when I rewrite it that will be the focus.

 

Regardless, repeating stack dumps make a game unplayable.

Link to comment
14 minutes ago, WaxenFigure said:

Bad design (using cloaking spells instead of

Just curious:  anybody has an idea where this bad habit had it's origin? And why it spread through so many (too many)  mods?

 

Link to comment
22 minutes ago, worik said:

Just curious:  anybody has an idea where this bad habit had it's origin? And why it spread through so many (too many)  mods?

 


nobody knew how to do it at first. the first guy that made it work, got copied over and over and over. its the reason 90% of everything in tech sucks lol.

Link to comment
16 hours ago, worik said:

Just curious:  anybody has an idea where this bad habit had it's origin? And why it spread through so many (too many)  mods?

 

It's documented in the Wiki for the SDK as THE way to do this.  So Bethesda, as usual.

Link to comment
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use