-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinNUT cannot reconnect automatically after Windows wakes up from sleep. #162
Comments
Hi @timmyhbk , I have to wonder if this is related to #145. WinNUT currently does not correctly handle the OS going from active -> suspend -> active states, so the next time system operation is resumed, it will continue to try exchanging data over a broken socket connection. This will almost immediately result in an error, which it reports, then tries reconnecting again. From what I can see in the log you posted, that seems to be the case here. You suspended your system at 01:59:59, then resumed around 02:06. WinNUT discovers the broken socket and goes through a reconnect procedure. After dealing with a strange response from the Synology DSM (fairly typical), it then seems to resume reading data from the NUT server normally. It looks like WinNUT was actually reconnected successfully after resuming from sleep. Please let me know if you think issue #145 is more closer to what you're experiencing, otherwise we'll need to troubleshoot this a little more. |
Hi @gbakeman , After testing for a while I did notice that occasionally the connection would be restored. But not always. When it doesn't reconnect, the GUI doesn't change, even if the UPS is disconnected. Clicking on the UPS Variable brings up Error Encountered. I tried logging different logs. hope this helps.
Thanks again for your help. |
Could you please verify for me that the IP address of the computer running WinNUT has been added to the Permitted Diskstation Devices list on your Synology? (Please see here for more info.) |
Yes, my settings are consistent with that article. |
Going back to when you said "the GUI doesn't change", do the gauges remain in a frozen state as if you were still connected to the UPS, even though you aren't? I've had issues with the gauges losing their state during a disconnection, although the rest of this is odd... I'm not really seeing the output I'd expect in your logs, so I'm going to need to ask you to do a slightly more involved test for me. First thing, please open the settings in WinNUT and make sure log output is set to Debug. Afterwards, hit the Ok button and exit WinNUT. Then navigate to the log files located at Now, please restart WinNUT and do the following things for me:
After doing all of that, please directly attach the log file to your next comment here. Don't worry about translating anything, although I appreciate you doing that for me. And thank you for working with me to troubleshoot this issue. |
I've noticed that if I put Windows to sleep and wake it up within a short period of time, I'm also experiencing gauge loss. This is the Log after following the instructions:
|
Thank you once again for doing that. I think I'm starting to understand what the issue may be - the Synology version of NUT server may be unhappy that WinNUT disappears without doing the LOGOUT command, and then doesn't accept any commands following that. Let me wrap up something I'm working on, then I'll take a deeper dive into this. |
Just had a chance to dig into this. To be honest, I'm shooting in the dark a little bit, but I picked what looked like an obvious low-hanging fruit; implementing basic support for system suspend events. There's a debug build up here, please give it a try and let me know how it goes. Thanks for your patience and testing efforts! |
After several tests. The first few times I woke up after a short sleep (about 5sec), the connection was successfully restored. However, after extending the interval between sleep and wakeup (5+mins), the connection still can't be resumed. During this time, I encountered several crashes. Strangely. Now I can't restore the connection after sleep in any way :( Thank you! Crash Report: Some Log |
Wow, that is not what I was expecting! 😅 Your detailed logs have led me to a deeper dive in WinNUT, and I've discovered several issues and cleaned up some dusty code that should have it handling connections better. I also discovered that it was using the NUT |
The new version still encounters the same situation. Sometimes it works. But most of the time the connection is still not restored. And sometimes it crashes. Log: Crash Report: I tried deleting user.config from appdata and resetting it. At first it appeared differently than before. It kept trying to reconnect 30 times. But in the end it still could not reconnect. But after I switched the log level to debug it was not reproducible. (Even if I change it back to Notice) Here is the log for that time: |
I'm surprised I have such a hard time reproducing these problems you're experiencing. All the same, your detailed error reports are helping me find yet more bugs to fix. Another build is up, thank you again for your tests! |
It still doesn't seem to work. But it didn't crash this time. Log There were a couple of long sleep-wake intervals. It succeeded to get back on line. Log that successfully restored the connection. not sure if that helps. Thanks again for your time! |
And thank you for your patience while we get to the bottom of this! I'm glad to hear that the crashes seem to have been fixed at least. I'm currently away now so we'll have to take a break, but I'll be back on this in the second half of the month. |
Just got back and had a chance to take another look at this. For whatever reason, Synology's NUT server does not want to share it's version with you after the client comes back from sleep (access denied error). I'm still have to wonder if this is because we're not disconnecting gracefully when going to sleep, but here's another build where I make WinNUT more fault-tolerant to servers that don't like sharing their version information. No need to run multiple tests if you still see a problem, just one log for each test is fine. I am curious though, if you do see issues, I'd like for you to delete your username and password from the preferences of WinNUT. This will stop it from trying to login, which may make the Synology happy when the client disconnects unexpectedly. Thanks again for your patience. |
The problem seems to be solved. |
There's a 2-3 minute lag before WinNUT recognizes it's disconnected and tries reconnecting? If you'd like to troubleshoot that further, could you upload a log of that session? |
I don't know why the previous log was not recorded. When I try to log, the recovery interval is not so long. But anyway, this result is good enough for me. Thanks for your help! |
Alright, hopefully just a fluke. And thanks again for all of your efforts with testing and providing feedback. I'll have this merged and closed in a little bit, then a pre-release update will be out shortly. |
Just before I close this - I took a look through your last log, and it appears that every variable is failing when you reconnect to your NUT server. It definitely seems like the Synology NUT server is behaving strangely. If you want, feel free to open a new discussion or issue and we can try to further troubleshoot what's going on. |
WinNUT Version:
2.3.8892.21649
Windows OS Version:
Windows 11 23H2 22631.3737
Describe the bug
When Windows resumes from sleep, WinNUT cannot connect.
Log stay on Try Reconnect 1 / 30.
Need to manually reconnect to resume the connection.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
WinNUT can automatically reconnect when Windows wakes up from sleep.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Log (I don't know how to get it to generate an English Log, so I've put an English translation below the text.)
UPS Variable
Thanks for your help.
The text was updated successfully, but these errors were encountered: