Fantasy Grounds Fridays Pre
Page 3 of 4 First 1234 Last
  1. #21
    Using 30-40% of my total memory, depending on what I have running in the background. Nothing seems to be spiking up during those hangs. Also just restarted and memory usage dropped back down to 2.3 GB after restart. When it hit a hang, I was up to 2.8 MB, though to be clear, that was a gradual increase over time as I kept working, not a big jumping spike during the hang.

    Compiled and attached logs right after the most recent hang. Timing does seem to match when one of the the autosaves happened (but it definitely isn't hanging regularly every 5 minutes). In this case, I'd been working for about 30 min before a big hang. I wonder if it just has to do with taking certain actions during that window of time where autosave is happening in the background, which would explain why as the DB gets bigger and autosave takes longer, this seems to happen more frequently.
    Attached Files Attached Files
    Last edited by Sterno; September 24th, 2021 at 19:35.

  2. #22
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    29,948
    Just curious, sorry if it's been mentioned before, does the issue happen to the same level with the UI scale set to 100%?
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #23
    Good question. I'm on a 2560x1440 monitor so I usually crank it to 125 or 150 uiscale when developing so I don't go blind.

    I'll try it at 100 for a while and see.

  4. #24
    Been watching this closely the last couple days and can say for sure it seems tied to autosave in some way. The hangs always occur at the same time as an autosave. Player.log always has a "Campaign saved." event logged right at the same time the hang ends.
    Last edited by Sterno; September 26th, 2021 at 00:18.

  5. #25
    Yeah, it's just odd that it doesn't occur on every auto-save; since we would think that it should be performing the same behaviors every time (at least the code is supposed to behave that way).

    Regards,
    JPG

  6. #26
    As my DB.xml has gotten bigger over the weekend (now up to 18.5 MB), it's actually rarer for the hang to NOT occur during the autosave than it is to see it happen. Also, it happens pretty frequently now if I've been working for a while and manually save (even if it just autosaved), though smacking the /save command a bunch of times in a row yields unpredictable results. For instance, after working for about 30 minutes, I just did 5 /save's in a row and four of the five hung. I also just tested opening Fantasy Grounds fresh, loading the campaign, and immediately hitting save, and I got the hang on the first try.

    I'll upload the latest version of this campaign to that same Google Drive I PM'd you earlier, since now it might be easier to reproduce.

    Right now, the end result is every 5 minutes or so, the app hangs 30-60 seconds for me. The hang time seems to be getting longer too. I'm guessing that the autosave is at the client level and there's no way for me to tweak the timing of it on my end via extension or otherwise?

  7. #27
    I think you're going to have to break up that campaign into separate modules. I don't believe there's not a single adventure in our store that has a 18.5MB db.xml file.

    Regards,
    JPG

  8. #28
    This happens to me quite often just playing the games - usually on open of a new item or filtered field (opening spells for example) - doesn't seem to happen opening reference manuals - more just anything that has to sort or filter. It never happens until I load all my content - I just assumed it was known about - I too run off an M.2 drive (512 gb - samsung 850 pro) 32 gb ram 6800xt - same thing as to resources - the rest of my machine runs fine - although I can't use discord if FG is the active window - I have to click outside of FG to use discord when it happens. I could take video if it helps

  9. #29
    Quote Originally Posted by Moon Wizard View Post
    I think you're going to have to break up that campaign into separate modules. I don't believe there's not a single adventure in our store that has a 18.5MB db.xml file.

    Regards,
    JPG
    AD&D MM is 20M
    Night Below is 21M
    Temple of Elemental evil is 12M

    That's not compressed in a .mod file, but the file before export.
    ---
    Fantasy Grounds AD&D Content Bundle (All The AD&D Content)
    Documentation for AD&D 2E ruleset.
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  10. #30
    Moon,

    I've dug deep into this slowdown and I've found that there are 4 functions in the save path that are responsible for 70-80% time spent saving to db.xml. In my testing the original save routines take 8.7s. I can get this down to less than 3s (more often than not 2.5s or less). In each case the function uses "text += c.ToString();" or similar on a single character. The Concat of a single character is very costly operation wise.

    Code:
    	public static string PPOHPFJPMNH(string LOBBPCAMNMN)
    	{
    		string text = string.Empty;
    		foreach (char c in LOBBPCAMNMN)
    		{
    			if (c > '\u007f' || c < ' ' || c == '"' || c == '<' || c == '>' || c == '&')
    			{
    				string str = text;
    				string str2 = "&#";
    				uint num = (uint)c;
    				text = str + str2 + num.ToString() + ";";
    			}
    			else
    			{
    				text += c.ToString();
    			}
    		}
    		return text;
    	}
    
    	public static string ODAKNCKJOBB(string LOBBPCAMNMN)
    	{
    		string text = string.Empty;
    		foreach (char c in LOBBPCAMNMN)
    		{
    			if ((int)c > -21 || c < 'c' || c == '7' || c == '$' || c == 'p' || (int)c == -39)
    			{
    				string str = text;
    				string str2 = "";
    				uint num = (uint)c;
    				text = str + str2 + num.ToString() + "leftlow";
    			}
    			else
    			{
    				text += c.ToString();
    			}
    		}
    		return text;
    	}
    
    	public static string IJJPNPDMCIM(string LOBBPCAMNMN)
    	{
    		string text = string.Empty;
    		for (int i = 0; i < LOBBPCAMNMN.Length; i++)
    		{
    			if (LOBBPCAMNMN[i] == '\r')
    			{
    				text += "\\r";
    			}
    			else if (LOBBPCAMNMN[i] == '\n')
    			{
    				text += "\\n";
    			}
    			else if (LOBBPCAMNMN[i] == '\\')
    			{
    				text += "\\\\";
    			}
    			else
    			{
    				text += LOBBPCAMNMN[i].ToString();
    			}
    		}
    		return text;
    	}
    
    	public static string DEKGFIBPNBA(string LOBBPCAMNMN)
    	{
    		string text = string.Empty;
    		bool flag = true;
    		foreach (char c in LOBBPCAMNMN)
    		{
    			if (flag)
    			{
    				if (LOBBPCAMNMN.Length > 2 && LOBBPCAMNMN.Substring(0, 3).Equals("xml", StringComparison.InvariantCultureIgnoreCase))
    				{
    					text += "_";
    				}
    				else if (c >= '0' && c <= '9')
    				{
    					text += "id-";
    				}
    				else if (!char.IsLetter(c) && c != '_')
    				{
    					text += "_";
    				}
    				flag = false;
    			}
    			if (char.IsLetterOrDigit(c) || c == '-' || c == '_' || c == '.')
    			{
    				text += c.ToString();
    			}
    		}
    		return text;
    	}
    If you replace PPOHPFJPMNH and IJJPNPDMCIM with the code below you can save this campaign in under 3 seconds. In my opinion the functions are equivalent in result.

    Code:
    	public static string IJJPNPDMCIM(string LOBBPCAMNMN)
    	{
    		string text = string.Empty;
    		int curPos = 0;
    		int lastSafePos = -1;
    		for (int i = 0; i < LOBBPCAMNMN.Length; i++)
    		{
    			char c = LOBBPCAMNMN[i];
    			if (c == '\r')
    			{
    				if (lastSafePos > -1)
    				{
    					text += LOBBPCAMNMN.Substring(curPos, lastSafePos - curPos + 1);
    					lastSafePos = -1;
    				}
    				text += "\\r";
    				curPos = i + 1;
    			}
    			else if (c == '\n')
    			{
    				if (lastSafePos > -1)
    				{
    					text += LOBBPCAMNMN.Substring(curPos, lastSafePos - curPos + 1);
    					lastSafePos = -1;
    				}
    				text += "\\n";
    				curPos = i + 1;
    			}
    			else if (c == '\\')
    			{
    				if (lastSafePos > -1)
    				{
    					text += LOBBPCAMNMN.Substring(curPos, lastSafePos - curPos + 1);
    					lastSafePos = -1;
    				}
    				text += "\\\\";
    				curPos = i + 1;
    			}
    			else
    			{
    				lastSafePos = i;
    			}
    		}
    		if (lastSafePos > -1)
    		{
    			text += LOBBPCAMNMN.Substring(curPos, lastSafePos - curPos + 1);
    		}
    		return text;
    	}
    	
    	public static string PPOHPFJPMNH(string LOBBPCAMNMN)
    	{
    		string text = string.Empty;
    		int curPos = 0;
    		int lastSafePos = -1;
    		for (int i = 0; i < LOBBPCAMNMN.Length; i++)
    		{
    			char c = LOBBPCAMNMN[i];
    			if (c > '\u007f' || c < ' ' || c == '"' || c == '<' || c == '>' || c == '&')
    			{
    				if (lastSafePos > -1)
    				{
    					text += LOBBPCAMNMN.Substring(curPos, lastSafePos - curPos + 1);
    					lastSafePos = -1;
    				}
    				string str3 = text;
    				string str2 = "&#";
    				uint num = (uint)c;
    				text = str3 + str2 + num.ToString() + ";";
    				curPos = i + 1;
    			}
    			else
    			{
    				lastSafePos = i;
    			}
    		}
    		if (lastSafePos > -1)
    		{
    			text += LOBBPCAMNMN.Substring(curPos, lastSafePos - curPos + 1);
    		}
    		return text;
    	}

    I suspect there are a number of other areas where strings are repeatedly using Concat on a single character.


    Thanks,
    Jason
    Last edited by jharp; September 28th, 2021 at 21:09. Reason: Bug in fix that I fixed operationally but not in my text file. (lastSafePos > -1)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in