Memory objects getting lost

I’m not running them 8th times but I’m running my code long enough to say it’s not fault of the framework at all.

might be issue in your VM, frankly nobody really knows what VM emulates and how

From your post, I understand this issue is specific to a scenario where you use your own code. In such a case, I don’t know what you are doing.

It depends the program code you are using.
What is the smallest change in the source code from the sanderling master branch which causes the issue to appear?

I appreciate any help.
I’m trying to figure out how to save the project so that you can look at it in an IDE, but here’s the best I can do real quick. (Is there more that I can provide to help?)

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Castle.Core" version="3.3.3" targetFramework="net461" />
  <package id="fasterflect" version="2.1.3" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
  <package id="protobuf-net" version="2.1.0" targetFramework="net461" />
</packages>
using Bib3.Geometrik;
using Sanderling.Interface.MemoryStruct;
using BotEngine.Interface;
using System;
using System.Linq;
using System.Threading;
using BotEngine.Common;
using System.Collections; //Required
using System.Collections.Generic;
using System.Text.RegularExpressions;

using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;

namespace Sanderling.Sample.Read
{
	/// <summary>
	/// This is just a minimal example of how to read from the eve online client process' memory.
	/// For more information, visit the project page at https://github.com/Arcitectus/Sanderling
	/// </summary>
	class Program
	{
		const int MeasurementTimeDistance = 300;
		static void SampleRun()
		{
			///Console.WriteLine("this program reads the memory of the eve online client process.");
			var eveOnlineClientProcessId = Extension.GetEveOnlineClientProcessId();

			if (null == eveOnlineClientProcessId)
			{
				Console.WriteLine("reading eve online client process id failed.");
				return;
			}

			///Console.WriteLine("\nstarting to set up the sensor and read from memory.\nthe initial measurement takes longer.");

			var sensor = new Sensor();

			for (; ; )
			{
				var stopwatch = new System.Diagnostics.Stopwatch();
				string totalTime;
				stopwatch.Start();
				var response = sensor?.MeasurementTakeNewRequest(eveOnlineClientProcessId.Value);
				stopwatch.Stop();
				totalTime = stopwatch.ElapsedMilliseconds.ToString();
				Console.Write("Time to take measurement and analysis: " + totalTime + "ms\n");
				if (null == response)
					continue;
				///Console.WriteLine("Sensor Interface not yet ready.");
				else
					MeasurementReceived(response?.MemoryMeasurement);
				Thread.Sleep(MeasurementTimeDistance);
			}
		}

		/// <param name="measurement">contains the structures read from the eve online client process memory.</param>
		static public void MeasurementReceived(BotEngine.Interface.FromProcessMeasurement<IMemoryMeasurement> measurement)
		{
		}
	}
}

Newest commit I see on master branch is Fix Bug · Arcitectus/Sanderling@4cf71f3 · GitHub

If you upload a commit to github with your changes based on that commit I can take a look at it.

I made no changes to the core code. I just used the API. When I next find it happening can I do anything to document it?

When the problem disappears with restarting Sanderling, it is tricky to document. In this case, a snapshot of the eve client process might not be sufficient to reproduce the problem.
You can save the memory measurement to a file which might be helpful for investigation. In the Sanderling app, you do it like described in the guide at How To Save A Memory Measurement To A File, use the MemoryMeasurement path to get the measurement before parsing. When you don’t have the measurement in the Sanderling App, you can use the approach from Parse.MemoryMeasurement serialization across processes to serialize the memory measurement to a string and then save this to a file using UTF8 Encoding.
In any case, record a screenshot of the eve client window along with the memory measurement.

Guys,

I have also noticed this issue but only on my sanderling instance running Windows 10 on a Parallels VM. Sometimes it will take quite a while for sanderling to acquire the first valid VM measurement, then it will work fine for a while, then lose the ability to do memory measurements again. I do not see it on my bare metal window install. Just thought I would share my current experience. Not sure if it is somehow VM related, or perhaps exposed by a slower running instance.

Hack

1 Like

Hmm, you just gave me an idea for what the cause could be… Dynamic or shared memory could be a reason. I’ll try them without it. Thanks!

Edit: still happening with static memory allocation.

I find that windows 10 under VM runs sanderling and eve very slowly with 2GB memory assigned to it … as time passes it gets worse and worse for both …

I have recompiled sanderling so I can run an x86 version with windows 7 x86 version (x86 appears to run without the eventual slowing down of eve and sanderling)

my two cents

@jyhad thank you for this. I have noticed over the last couple month my VM is getting excessively sluggish when I start sanderling to the point where the eve client becomes very unresponsive.

Hack.

Do you see memory usage for the Sanderling process growing in that case?
What is the maximum value you see in the Windows Task Manager under Memory for the Sanderling process?

My VMs reboot once per day, and I don’t notice enough RAM increase to be worth investigating. (If any, it is under 10% of VM RAM.)

I understand that it can’t be read if it is closed. 3 times now I’ve found that the list in the overview isn’t found even though the overview window is open and displaying entries.

My solution doesn’t use the Sanderling UI. It just loops looking for the overview list element, even when docked, and occasionally changing overview tabs while a measurement might be taken at the same time. If the overview list is found then the bot should be in space, else no overview list means it should be docked. However, if it is in space and Sanderling can’t find the overview list, then I can’t tell it to dock because no lines means no stations to dock with.

It is easy to check if the ship is in space and the overview list element isn’t being found anymore. The problem is what to do once this has happened, because the problem is persistent.

@Viir
Okay, I just caught it and I did my best to document what is going on. (For some reason my VM environment wouldn’t allow me to save a memory measurement to a file. I followed the video and dragged the text file over the File button, but the mouse icon stayed on the No image and dropping the file on the button did nothing. I even tried the latest version of Sanderling. I try to run my VMs very lean, but if you can point to something I need to enable I’ll gladly do it.)

The issue (this time) was that it stopped finding the Module element persistently. Persistent to the point that it persisted through restarting Sanderling. (I even downloaded and tried the latest UI version.) I tried docking and undocking then restarting the latest Sanderling UI, but no change. The only thing that fixed the issue was closing/restarting the eve client and then starting Sanderling again.

SanderlingMissingModules2

In this case, I recommend to test reproducing the problem using a process measurement of the eve online client.

With the Demo_memory_reading_from_process_sample method, you should be able to get the same Sanderling memory measurement from the saved process measurement.

Thank you. I was running the processes as admin, so that explains why the drag/drop didn’t work. I will try this next time it occurs. Thank you.

Okay, found this happened again with a different UI element. Downloaded the tool and tried it but was ultimately successful because the Eve client is run as admin. Running as admin, about my 3rd admin attempt the measurement was successful, but I couldn’t drag a folder/file onto the spot because everything was run as admin, which is the same problem as before.

Is there a way to just have it create a new folder or something (even if in folder the tool is started in)?

Or can you send me an EXE or tell me the code to run to write to the folder that the application is running from?

Edit: here’s some more info. The Eve client is started by a script that is run as admin, meaning that I’m unable to run the tool from the same parent process, so even running as admin doesn’t work for drag and drop.

I found what seems like a workaround to getting a snapshot, but am busy. Will post it sometime today.

I was able to do it the way detailed in the How to collect samples for memory reading development thread. The trick is to open Notepad as admin, and File->Open within it. Within the Open window drag the file/folder. The result seems to be about 250mb, so I will upload that soon with an explanation of what is missing from the snapshot.

The trick allowed me to drop a txt file into the Sanderling Exe, as detailed in How To Save A Memory Measurement To A File, but it generated an error that I’ll send (with log) when I get home this evening.

@Viir I have sent you a PM with the example memory snapshot I was able to get, as well as the error I mentioned in the post above.

I doubt this works with the current binaries. But when making a change to the source code, why not.

I don’t know of such an EXE.