Jump to content

Calling savegame command from script causes freeze


FinalFrog

Recommended Posts

I'm trying to implement rotating autosaves in the style of Oblivion's Streamline with Script Dragon but I've run into a major problem. When my script calls "savegame <savename>" the game freezes entirely. Checking the Saves folder I can confirm that my script is calling the command properly because it creates a blank file named "<savename>.ess.tmp".

 

I've been taking shots at debugging this issue for weeks with no luck and thought I'd seek help here.

I've attached my current source code below for reference.

 

Here's what I've determined so far:

*Calling Game::RequestSave() works 100% of the time, but uses the default save naming format and cannot overwrite previous saves. (Currently using this until I can fix the issue)

*The freeze seems to occur randomly, sometimes not occurring until after 5 or 6 successful saves.

*The freeze occurs 100% of the time on the first try when loading some particular saves.

*Memory usage does not spike when saving (Not an OoM issue)

*The issue only occurs when calling from a script (Calling "savegame <savename>" manually with the console works every time with no issues)

*Setting iSaveGameBackupCount=0 does not fix the issue

*Disabling Autosave does not fix the issue

*Forcing menu mode through a popup box prior to saving does not fix the issue.

 

I highly suspect that the problem is due to a thread locking issue but am unsure as how to test this theory or fix it. Any advice would be greatly appreciated.

-finalfrog

 

Edit: Turns out I need to remember to turn off NotScripts more often. Uploaded source properly. =P

Link to comment
Share on other sites

I'm trying to implement rotating autosaves in the style of Oblivion's Streamline with Script Dragon but I've run into a major problem. When my script calls "savegame <savename>" the game freezes entirely. Checking the Saves folder I can confirm that my script is calling the command properly because it creates a blank file named "<savename>.ess.tmp".

 

I've been taking shots at debugging this issue for weeks with no luck and thought I'd seek help here.

I've attached my current source code below for reference.

 

Here's what I've determined so far:

*Calling Game::RequestSave() works 100% of the time, but uses the default save naming format and cannot overwrite previous saves. (Currently using this until I can fix the issue)

*The freeze seems to occur randomly, sometimes not occurring until after 5 or 6 successful saves.

*The freeze occurs 100% of the time on the first try when loading some particular saves.

*Memory usage does not spike when saving (Not an OoM issue)

*The issue only occurs when calling from a script (Calling "savegame <savename>" manually with the console works every time with no issues)

*Setting iSaveGameBackupCount=0 does not fix the issue

*Disabling Autosave does not fix the issue

*Forcing menu mode through a popup box prior to saving does not fix the issue.

 

I highly suspect that the problem is due to a thread locking issue but am unsure as how to test this theory or fix it. Any advice would be greatly appreciated.

-finalfrog

 

To test that theory you can use the Windows Debugging Tools and attached WinDBG to the TESV.EXE process and look for a deadlock. Easier said than done for most. You may have to configure the symbols path for WINDBG to point to Microsoft's public symbol servers and then dump all the thread stacks. On the surface, It almost sounds like you have a deadlock where one thread is waiting for a resource owned by another, and the other is waiting for a resource owned by it. But then, it could be any number of things.

 

IF you can get WINDBG installed + point to MS public symbols and attached WINDBG to the TESV process you can dump all the threads with the following cmd:

 

~*knL 100

 

I don't use Script Dragon but if it has an external .exe that loads TESV then it might be the script dragon process that's deadlocking.

 

If you get the above output I could confirm whether it's a deadlock for you. But I imagine that with your code and someone that is intimately familiar with Script Dragon might do you better. Have you tried contacting the author?

 

-MM

 

P.S. Am I daft? I don't see your source code attached. Is that a premium only thing?

Edited by MofoMojo
Link to comment
Share on other sites

Thanks for the advice! I'll try that and see if I can figure out what's causing the issue.

 

P.S. Am I daft? I don't see your source code attached. Is that a premium only thing?

You're not daft. I'm a moron. =P Fixing that oversight now.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...