nickbabcock / OhmGraphite

Expose hardware sensor data to Graphite / InfluxDB / Prometheus / Postgres / Timescaledb
Other
426 stars 38 forks source link

Fatal error when virtual RamDisk is running #412

Closed EugeneSoftwareDeveloper closed 1 month ago

EugeneSoftwareDeveloper commented 11 months ago

When run ramDisk

image

image

When ramdisk is stoped there is no error

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.SpanHelpers.IndexOf(Byte ByRef, Byte, Int32) at System.String.Ctor(SByte*) at System.Runtime.InteropServices.Marshal.PtrToStringAnsi(IntPtr) at LibreHardwareMonitor.Hardware.Storage.WindowsStorage+StorageInfo.GetString(IntPtr, UInt32) at LibreHardwareMonitor.Hardware.Storage.WindowsStorage+StorageInfo..ctor(Int32, IntPtr) at LibreHardwareMonitor.Hardware.Storage.WindowsStorage.GetStorageInfo(System.String, UInt32) at LibreHardwareMonitor.Hardware.Storage.AbstractStorage.CreateInstance(System.String, UInt32, UInt64, Int32, LibreHardwareMonitor.Hardware.ISettings) at LibreHardwareMonitor.Hardware.Storage.StorageGroup.AddHardware(LibreHardwareMonitor.Hardware.ISettings, System.Collections.Generic.Dictionary2<UInt32,System.Collections.Generic.List1<System.ValueTuple`2<UInt32,UInt64>>>) at LibreHardwareMonitor.Hardware.Storage.StorageGroup..ctor(LibreHardwareMonitor.Hardware.ISettings) at LibreHardwareMonitor.Hardware.Computer.AddGroups() at LibreHardwareMonitor.Hardware.Computer.Open() at OhmGraphite.SensorCollector.Start() at OhmGraphite.PrometheusServer.b4_0() at OhmGraphite.LoggerUtils.LogAction(NLog.Logger, System.String, System.Action) at OhmGraphite.PrometheusServer.Start() at OhmGraphite.Worker+<>c__DisplayClass3_0.b0() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task+<>c.<.cctor>b__272_0(System.Object) at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread) at System.Threading.Tasks.Task.ExecuteEntryUnsafe(System.Threading.Thread) at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()

nickbabcock commented 11 months ago

Does disabling storage devices via the OhmGraphite config at least let you run without errors?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="/storage/enabled" value="false" />
  </appSettings>
</configuration>

If so, I'd be curious if the GUI version gives you the same error: https://github.com/LibreHardwareMonitor/LibreHardwareMonitor#where-can-i-download-it

EugeneSoftwareDeveloper commented 11 months ago

Does disabling storage devices via the OhmGraphite config at least let you run without errors?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="/storage/enabled" value="false" />
  </appSettings>
</configuration>

If so, I'd be curious if the GUI version gives you the same error: https://github.com/LibreHardwareMonitor/LibreHardwareMonitor#where-can-i-download-it

Yes. Disable storage devices helped. I would like to be able to disable a specific drive.

LibreHardwareMonitor work wihtout errors.

image

nickbabcock commented 11 months ago

Is the ramdisk included in the gui or has it been excluded?

EugeneSoftwareDeveloper commented 11 months ago

The patition is not displayed. Only displayed hard disks and ssd.

RamDisk is not displayed (excluded).

image

nickbabcock commented 10 months ago

Do you get the same error when you run OhmGraphite interactively (in an administrator terminal)?

./OhmGraphite stop
./OhmGraphite run
EugeneSoftwareDeveloper commented 10 months ago

Do you get the same error when you run OhmGraphite interactively (in an administrator terminal)?

./OhmGraphite stop
./OhmGraphite run

Also stops after starting. Run as admin + comments line <add key="/storage/enabled" value="false" />

image

nickbabcock commented 10 months ago

The screenshot is a little confusing. To run interactively, execute OhmGraphite.exe run (the screenshot shows OhmGraphite.exe start)

EugeneSoftwareDeveloper commented 9 months ago

The screenshot is a little confusing. To run interactively, execute OhmGraphite.exe run (the screenshot shows OhmGraphite.exe start)

Fatal error. Look logFromConsole.txt

nickbabcock commented 9 months ago

Thank you for posting, and your patience.

Tracing the logic, both LibreHardwareMonitor and OhmGraphite execute the same code, and while I don't know for 100%, it seems like the kernel is exposing different values to both. LibreHardwareMonitor receives either an invalid result or a false return from DeviceIoControl which is why it excludes it. For some reason, OhmGraphite doesn't and thinks the drive is valid (and thus fails).

I'm not sure what the next step is. Very confusing.

nickbabcock commented 1 month ago

This should be fixed in v0.34, let me know if otherwise.