HWInfo64 crash with Shared Memory and Custom Sensors

douglas_drewser

New Member
Hi,

I have a problem with HWINfo64 (v 7.17.4675.0)

If I enter some custom sensors in the registry (as attached, 7zip'd) AND enable Shared Memory, it crashes on start.

If I switch off Shared Memory (SensorsSM=0 in the ini file) it starts fine and displays the custom sensors ok.

If I then enable Shared Memory in the UI and click apply it crashes immediately.

If I remove the custom sensors from the registry, but leave SHared Memory enabled, it runs fine.

So it seems i can have Shared Memory OR custom sensors, but not both.

DBG file attached.

Hope you can help.

Thanks
 

Attachments

  • HWiNFO64.DBG
    1.2 MB · Views: 2
  • HWINFO_CustomSensors.7z
    467 bytes · Views: 2

Martin

HWiNFO Author
Staff member
I'm trying to reproduce this issue but can't get it to crash. Can you please check which of those custom sensor values is causing it? Is it perhaps just one of those or any?
Also, which application pulling data from shared memory are you using? Will HWiNFO crash also when this application is not running perhaps?
 
Last edited:

douglas_drewser

New Member
Hi Martin, thanks for looking into this.

It seems if I have any Custom Sensor values at all it will crash.

I.e. if I just create a key with no values it will still crash.

1. Create empty key HKEY_CURRENT_USER\Software\HWiNFO64\Sensors\Custom, all is ok
2. Create empty sub-key HKEY_CURRENT_USER\Software\HWiNFO64\Sensors\Custom\MyClocks, will crash
3. Remove empty sub-key HKEY_CURRENT_USER\Software\HWiNFO64\Sensors\Custom\MyClocks, all ok again

The only app I am aware of that queries the shared memory is Mod Bros windows app - https://www.mod-bros.com/

I have tried exiting the ModBros app (and the ModBros service) and HWInfo stops crashing (with Shared Mem and Custom Values enabled).

If I start HWinfo first and then start ModBros second, all seems ok.

It certainly seems to be an interaction between ModBros and HWInfo.

Do you mind if I share this thread on the ModBros forum, to get the ModBros devs to take look?
 

Martin

HWiNFO Author
Staff member
Yes, feel free to share this on the ModBros forum as it seems to be some interaction between both tools.
I suspect that the problem might be improper use of the shared memory synchronization mutex "Global\HWiNFO_SM2_MUTEX". Please ask them whether they use it and if yes, if they properly and quickly release it in all code paths.
 

Seraksab

New Member
I just tested myself and can indeed reproduce the issue following the steps mentioned above by douglas_drewser

We do not use the mutex. Since we're accessing the memory-mapped file with read permissions only, I figured there was no real need for that.
However, once we successfully opened the file we currently keep that reference and keep using it to periodically read the file.
So I suspect that adding a new custom sensor causes HWiNFO to recreate the memory-mapped file. Which currently fails as a result of MoBro still holding onto the file and preventing its deletion.
I've now changed the code to reopen the file whenever we attempt to read it and dispose of the reference directly after. This already resolves the issue for me.

Is this fix enough or would you suggest to additionally synchronize the file access by using the mutex as well?

Regards,
Seraksab (ModBros)
 

Martin

HWiNFO Author
Staff member
I just tested myself and can indeed reproduce the issue following the steps mentioned above by douglas_drewser

We do not use the mutex. Since we're accessing the memory-mapped file with read permissions only, I figured there was no real need for that.
However, once we successfully opened the file we currently keep that reference and keep using it to periodically read the file.
So I suspect that adding a new custom sensor causes HWiNFO to recreate the memory-mapped file. Which currently fails as a result of MoBro still holding onto the file and preventing its deletion.
I've now changed the code to reopen the file whenever we attempt to read it and dispose of the reference directly after. This already resolves the issue for me.

Is this fix enough or would you suggest to additionally synchronize the file access by using the mutex as well?

Regards,
Seraksab (ModBros)

Thanks for looking into this and the update, it should be sufficient.
Yes, HWiNFO does re-create the memory-mapped file in case the number of sensors changes during runtime. So I should also check on my side how to avoid such issues...
 

douglas_drewser

New Member
Great news, thx Martin and Seraksab for your efforts.

I have a workaround at the moment to make sure I always start HWInfo64 first and then ModBros.

I will update to the latest version of both as and when they are released.

Keep up the good work!
 
Top