nutdotnet / WinNUT-Client

WinForms-based client for monitoring your Uninterruptible Power Supply (UPS) connected to a Network UPS Tools (NUT) server.
GNU General Public License v3.0
209 stars 19 forks source link

Crashes relating to bad/out-of-range values reported by NUT server #129

Closed aazz-top closed 7 months ago

aazz-top commented 8 months ago

我的UPS电源连接在群晖DS220+上。 群晖的设置已经正确,所有状态正常,IP也允许局域网的IP。 通过ssh的 upsc ups 也看见了ups 的状态。 但是windows上无法用winnut连接。连接成功后会立刻连接失败。.OverflowException: 算术运算导致溢出。 先连接建立成功,1秒钟不到,.OverflowException: 算术运算导致溢出。连接断开。 试了3个版本 2.0 2.2 。

System.OverflowException: 算术运算导致溢出。 在 WinNUT_Client.WinNUT.Event_UpdateBatteryState(String Reason) 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client\WinNUT.vb:行号 533 在 WinNUT_Client.WinNUT.UPSDisconnectedEvent() 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client\WinNUT.vb:行号 359 在 WinNUT_Client_Common.UPS_Device.DisconnectedEventHandler.Invoke() 在 WinNUT_Client_Common.UPS_Device.Disconnect(Boolean cancelReconnect, Boolean forceful) 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client_Common\UPS_Device.vb:行号 185 在 WinNUT_Client_Common.UPS_Device.Retrieve_UPS_Datas(Object sender, EventArgs e) 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client_Common\UPS_Device.vb:行号 366 在 System.Windows.Forms.Timer.OnTick(EventArgs e) 在 System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

gbakeman commented 8 months ago

Hello,

Please update to the latest Pre-Release and let me know if you still experience the error.

aazz-top commented 8 months ago

Hello,

Please update to the latest Pre-Release and let me know if you still experience the error.

PC: windosw 10 22H2

Pre-Release v2.3.8800

System.OverflowException: 算术运算导致溢出。 在 WinNUT_Client.WinNUT.Event_UpdateBatteryState(String Reason) 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client\WinNUT.vb:行号 587 在 WinNUT_Client.WinNUT.UPSDisconnectedEvent() 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client\WinNUT.vb:行号 480 在 WinNUT_Client_Common.UPS_Device.DisconnectedEventHandler.Invoke() 在 WinNUT_Client_Common.UPS_Device.Disconnect(Boolean cancelReconnect, Boolean forceful) 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client_Common\UPS_Device.vb:行号 186 在 WinNUT_Client_Common.UPS_Device.Retrieve_UPS_Datas(Object sender, EventArgs e) 位置 C:\Users\Glen\Repositories\nutdotnet\WinNUT-Client\WinNUT_V2\WinNUT-Client_Common\UPS_Device.vb:行号 367 在 System.Windows.Forms.Timer.OnTick(EventArgs e) 在 System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

gbakeman commented 8 months ago

I can see where the error is occurring, although I'm not quite sure why. Please download the debug build from here once it is available and let me know if it works. If you encounter an error again, please attach the full log file to your comment.

aazz-top commented 8 months ago

I can see where the error is occurring, although I'm not quite sure why. Please download the debug build from here once it is available and let me know if it works. If you encounter an error again, please attach the full log file to your comment.

WinNUT-Client-2024-02-08.log System.NullReferenceException 未将对象引.txt

thank you very much ! this is log file

gbakeman commented 8 months ago

It looks like the original problem may have been fixed, although you found another one relating to the log file! I have another build going here. Please see if you can find any issues in this one. Thank you for your help!

aazz-top commented 8 months ago

It does not work properly and is automatically disconnected repeatedly.also. WinNUT-Client-2024-02-09.log

gbakeman commented 8 months ago

I'm sorry, I'm going to have to look into this more. I think I need to make some changes in how WinNUT logs information so that will make it easier for me to troubleshoot issues, and it also looks like we may be facing an edge case or two being reported by the UPS. Please stand by.

aazz-top commented 7 months ago

I'm sorry, I'm going to have to look into this more. I think I need to make some changes in how WinNUT logs information so that will make it easier for me to troubleshoot issues, and it also looks like we may be facing an edge case or two being reported by the UPS. Please stand by.

what can i do for you

gbakeman commented 7 months ago

I just had a chance to make another small update. I don't expect this will fix the immediate issue, but I hope that it does improve logging somewhat. Please give this build a try and upload the log file. After this, I should be able to fix the current issue you're experiencing. You've been wonderful so far, thank you for your patience.

aazz-top commented 7 months ago

I just had a chance to make another small update. I don't expect this will fix the immediate issue, but I hope that it does improve logging somewhat. Please give this build a try and upload the log file. After this, I should be able to fix the current issue you're experiencing. You've been wonderful so far, thank you for your patience.

WinNUT-Client-2024-02-18.log plz cheak it thanks

gbakeman commented 7 months ago

I've made some changes that I think will fix the issue you're facing now, download here. Whether this one is successful or not, please upload the log again after testing. Thank you again for testing this.

aazz-top commented 7 months ago

I've made some changes that I think will fix the issue you're facing now, download here. Whether this one is successful or not, please upload the log again after testing. Thank you again for testing this.

WinNUT-Client-2024-02-28.log

Thank you very much, it is running successfully.Thank youThank youThank youThank youThank you

gbakeman commented 7 months ago

And thank you for your patience and persistence - you helped me fix at least three different bugs here. I do want to mention that it looks like your UPS or NUT server are reporting strange values for different variables, mostly related to the battery. You may want to try restarting your NUT server to see if that corrects some of the values again.

In the meantime, I will work on sending out another pre-release so you can continue using WinNUT normally without the debug build.