Skip to content
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

Auto reconnect feature stops on error when started for the first time #104

Closed
masterwishx opened this issue Oct 8, 2023 · 24 comments · Fixed by #107
Closed

Auto reconnect feature stops on error when started for the first time #104

masterwishx opened this issue Oct 8, 2023 · 24 comments · Fixed by #107
Assignees
Labels
bug Something isn't working

Comments

@masterwishx
Copy link

When windows bootted no connection , becouse i think no internet connection on windows start.
but setting reconnect is not working (5 sec).
When make reconnect manual, all working.

image

image

image

Maybe somehow blocked by Norton Antivir but included in exclude list

@gbakeman
Copy link
Contributor

gbakeman commented Oct 8, 2023

Does it appear that WinNUT is still trying to connect automatically when you start it, or is it not even doing that?

Could you please try the following steps:

  • Close WinNUT
  • Open it again
  • Wait about 10 seconds
  • If not connected now, then connect manually
  • Close WinNUT again

Then upload the last log file by opening the folder (found in the options menu in the miscellaneous tab) and clicking and dragging the file into the GitHub message box.

@masterwishx
Copy link
Author

Does it appear that WinNUT is still trying to connect automatically when you start it, or is it not even doing that?

Could you please try the following steps:

its doing nothing.

if i close then run again its OK.
i think problem on boot only , when Windows start and like internet connection not avalible on start and take some time for it appear ...

@gbakeman
Copy link
Contributor

gbakeman commented Oct 8, 2023

Let me have you do this then: in the miscellaneous tab, set the logging level to Debug, make sure logging is enabled, then click ok and exit WinNUT. Then restart your computer, and allow WinNUT a small amount of time to try to connect. After that, please find the log file and upload it here.

Edit: I also see your bug about WinNUT not closing - if it stops, go ahead and force close it after waiting about 5 seconds.

@masterwishx
Copy link
Author

Let me have you do this then: in the miscellaneous tab, set the logging level to Debug, make sure logging is enabled, then click ok and exit WinNUT. Then restart your computer, and allow WinNUT a small amount of time to try to connect. After that, please find the log file and upload it here.

Strange , but this time after reboot its connected.
i only enabled and then disabled (run app like administrator in program shortcut).
i will try it again some time if will no problem i will close issue )
also i can disable inet connection and check it if will be reconnection running

image

@masterwishx
Copy link
Author

also i saw error about login:

image

i have slave user and password on ups nut server
but in app wrote leave blank on user and password , i think it was also in old 2.0 version.
So its connecting without username and password somehow ?

@gbakeman
Copy link
Contributor

gbakeman commented Oct 8, 2023

Let me have you do this then: in the miscellaneous tab, set the logging level to Debug, make sure logging is enabled, then click ok and exit WinNUT. Then restart your computer, and allow WinNUT a small amount of time to try to connect. After that, please find the log file and upload it here.

Strange , but this time after reboot its connected. i only enabled and then disabled (run app like administrator in program shortcut). i will try it again some time if will no problem i will close issue ) also i can disable inet connection and check it if will be reconnection running

WinNUT currently saves settings in the user registry hive (another issue to track moving this into a file is #100 ), so I wonder if starting it with administrative privileges is causing it to work with two different sets of settings. WinNUT is designed to be run as a standard user (non-administrator) only so please make sure it isn't running as admin.

The login routine is a bit of a curious one with the NUT software and one I don't understand completely. I believe it's intended to tell NUT that you're depending on a UPS for power, so you don't actually need to login in order to read UPS data which is what people do 99% of the time anyways. I think this also gets confused with the Synology server which requires an I.P whitelist in order to connect or read any data from the UPS. All of this to say, WinNUT probably shouldn't have to login at all so I may need to look into that (edit: see #106)

Thank you for offering the continue testing this issue. If I could ask you in the future, please upload the log file by dragging it directly into the issue so the entire text file is uploaded (or paste it in a code block.) That will be easier for me to work with than a picture :)

@masterwishx
Copy link
Author

WinNUT is designed to be run as a standard user (non-administrator) only so please make sure it isn't running as admin.

i only enabled checked and then disabled , i saw no difference only when i enabled programs dpi :
it was a little strange smaller view but then also disabled.

Image

Thank you for offering the continue testing this issue. If I could ask you in the future, please upload the log file by dragging it directly into the issue so the entire text file is uploaded (or paste it in a code block.) That will be easier for me to work with than a picture :)

i will be glad to help from what i can. im using NUT plugin in Unraid server.
OK i will upload log if it will be needed

@gbakeman
Copy link
Contributor

gbakeman commented Oct 8, 2023

Thank you - please double check that the WinNUT settings are correct, then try another reboot with admin and DPI settings disabled.

@masterwishx
Copy link
Author

Yes I disabled them after checked how it work with it, I will check again at morning boot tomorrow and will let know

@masterwishx
Copy link
Author

Sending the log as at morning was no auto reconnection when was no internet on boot.
then i manually reconnected .

[38] 09.10.2023 8:52:01 [14692, String]: New Log to CB_Current Log : Соединение с сервером NUT 192.168.0.199:3493 Отказ: Сделана попытка выполнить операцию на сокете при отключенной сети [::ffff:192.168.0.199]:3493
WinNUT-Client-2023-10-09.log

@masterwishx
Copy link
Author

i checked ,if i disable inet when app is running , then auto reconnect is working until i enabled inet and all OK.
But in morning windows boot there was no reconnection like you can see in log i sended befor ...

@masterwishx
Copy link
Author

in 17:19 i booted win also no connection ,when i reconnect manually, norton popup, hoverer i excluded WinNut:
also sending log again :

UPS_Device]: Beginning connection: @192.168.0.199:3493, Name: Eaton9E2000i [AutoReconnect]
09.10.2023 17:19:17 [13400, Nut_Socket]: Attempting TCP socket connection to 192.168.0.199:3493...
09.10.2023 17:19:17 [13400, WinNUT]: Something went wrong connecting to UPS Eaton9E2000i. IsConnected: False, IsAuthenticated: False
09.10.2023 17:19:17 [13400, String]: New Log to CB_Current Log : Соединение с сервером NUT 192.168.0.199:3493 Отказ: Сделана попытка выполнить операцию на сокете при отключенной сети [::ffff:192.168.0.199]:3493
09.10.2023 17:19:17 [13400, WinNUT]: Completed WinNUT_Shown

WinNUT-Client-2023-10-09.log

image

@UltrashRicco
Copy link

Hello, I am new to WinNut. I am facing a similar issue where after a shutdown, after the UPS shuts down and powers back up, my Windows machine boots faster than my router, and faster than the machine running the NUT server. When Winnut starts and finds no network, it just appear to cease to try (because the requested IP is unreachable). I am not even sure it goes through the 30 connection attempts. In any case, it does not always happen but when it does, it takes a manual reconnect.

I would suggest increasing the number of connection attempts, or to make it configurable (up to infinite reconnect attempts).

Thanks!

@masterwishx
Copy link
Author

Hello, I am new to WinNut. I am facing a similar issue where after a shutdown, after the UPS shuts down and powers back up, my Windows machine boots faster than my router, and faster than the machine running the NUT server. When Winnut starts and finds no network, it just appear to cease to try (because the requested IP is unreachable). I am not even sure it goes through the 30 connection attempts. In any case, it does not always happen but when it does, it takes a manual reconnect.

I would suggest increasing the number of connection attempts, or to make it configurable (up to infinite reconnect attempts).

Thanks!

As no answer from developer until now, I can suggest to use old original version 2.0, it's have auto reconnect on boot.
Or to make delay on boot for Winnut in Reg Organizer.

@masterwishx
Copy link
Author

Until it will be fixed here...

@UltrashRicco
Copy link

UltrashRicco commented Oct 15, 2023

Thanks for the feedback. I did think of delaying the start of WinNUT (by 30-60 seconds, should be enough) but I have not figured out how yet. Thank you for suggesting Reg Organizer, I did not know about it, however I would personnally prefer not having to use a third-party solution for this.
I can see that the WinNUT client is not a service, but an .exe that is launched at startup. I have not investigated much, but a quick search shows that both can easily be launched with a delay. In the case of a program, it can be done with the built-in Windows task scheduler quite easily, apparently, and with no third-party solution.
This however would likely not address my usecase, as I do not shutdown the computer upon UPS low battery when working on battery power only, as upon resuming the session, WinNUT would already be running and would attempt to reconnect immediately, and might fail to do so.
It would work fine after a shutdown and subsequent reboot though, so it can still be used as a workaround.

@gbakeman gbakeman changed the title No auto connection (reconnect) on windows boot Auto reconnect feature stops on error when started for the first time Oct 15, 2023
@gbakeman
Copy link
Contributor

Hi all,

Sorry for disappearing, I had some other things come up. I am able to reproduce the issue on my machine so let me see if I can have a debug build up for you.

@gbakeman
Copy link
Contributor

This ended up being a very simple fix. I forgot I had disabled the auto-retry function, but only when WinNUT starts for the first time. Sorry for the trouble, everyone. Please try the debug artifact here if you want (and please confirm here if it is indeed fixed), otherwise I'll try to get a few other fixes done before I push out another pre-release.

Thanks for your patience!

@gbakeman gbakeman self-assigned this Oct 15, 2023
@gbakeman gbakeman added the bug Something isn't working label Oct 15, 2023
@gbakeman gbakeman added this to the 2.2 Stable Release milestone Oct 15, 2023
@UltrashRicco
Copy link

Well, that was quick, thanks!
I tried the build: I rebooted with the computer disconnected from the local network. From what I can see, WinNUT does carry out its 30 connection attempts, then stops and waits for a manual connection. I am attaching the log and a screenshot.
I would love to contribute more, but I am affraid coding is beyond my abilities.
WinNUT-Client-2023-10-15.log
2023-10-15_17h49_07

@gbakeman
Copy link
Contributor

Hi @UltrashRicco ,

This is considered normal behavior for the auto-reconnection routine, at least when WinNUT is unable to make a connection to the server. Were you expecting a different behavior?

@UltrashRicco
Copy link

UltrashRicco commented Oct 15, 2023

Hi! I understand, thank you.
I would expect a configurable ammount of retries, up to infinity, as I suggested above, as getting information from the UPS and performing a graceful shutdown is critical in many scenarios: #104 (comment)

@gbakeman
Copy link
Contributor

Good point, we currently do not allow configuration of the reconnection attempts. You may want to follow #65 since I think that may address your concerns.

@UltrashRicco
Copy link

@gbakeman ah, indeed, thank you, I did have a look through the open issues but did not find #65 and thought I would contribute here instead, sorry for the possible confusion!

@gbakeman
Copy link
Contributor

No worries at all, thank you for providing the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants