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

Increase timeout from 250 to 750 ms to allow more time for UPS response #543

Conversation

stevegilbert23
Copy link
Contributor

This pull request attempts to resolve issue reported in: #542

… 750 ms to allow more time for UPS response

Signed-off-by: Steve Gilbert <[email protected]>
@stevegilbert23
Copy link
Contributor Author

I've added an empty commit with sign-off line hoping that will make the difference and get this pull request accepted.

@clepple clepple self-requested a review May 28, 2018 21:11
Copy link
Member

@clepple clepple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign-off line is not needed.

It would have been nice to get some confirmation that this commit worked with other hardware, but I guess we can always revert it later.

clepple pushed a commit that referenced this pull request May 28, 2018
… 750 ms to allow more time for UPS response

(cherry picked from commit 5cea18c --@clepple)

Closes: #543
Closes: #542
@2E0PGS
Copy link

2E0PGS commented May 29, 2018

Hi whats the status of this? Is there a branch thats stable I can pull with the merged changes and build manually? I believe the commit @stevegilbert23 wrote is now cherry picked into: https://github.com/networkupstools/nut/tree/libusb-1.0%2B0.1 is this branch stable? when is that branch going to be merged into master?

Is there any other useful changes in that branch which may help fix my problems? I saw quite a bit of talk about the issues with older libusb version here: #300

I suspect this is whats causing my problems with powerwalker UPS and /lib/nut/usbhid-ups -a powerwalker:

May 26 01:56:49 ubuntuserver1 upsd[8689]: Send ping to UPS [powerwalker] failed: Resource temporarily unavailable
May 26 01:56:50 ubuntuserver1 upsd[8689]: Connected to UPS [powerwalker]: usbhid-ups-powerwalker
May 26 01:57:07 ubuntuserver1 upsd[8689]: Data for UPS [powerwalker] is stale - check driver
May 26 02:27:44 ubuntuserver1 upsd[8689]: Send ping to UPS [powerwalker] failed: Resource temporarily unavailable
May 26 02:27:45 ubuntuserver1 upsd[8689]: Connected to UPS [powerwalker]: usbhid-ups-powerwalker
May 26 02:28:02 ubuntuserver1 upsd[8689]: Data for UPS [powerwalker] is stale - check driver
May 26 02:58:43 ubuntuserver1 upsd[8689]: Send ping to UPS [powerwalker] failed: Resource temporarily unavailable
May 26 02:58:45 ubuntuserver1 upsd[8689]: Connected to UPS [powerwalker]: usbhid-ups-powerwalker
May 26 02:59:01 ubuntuserver1 upsd[8689]: Data for UPS [powerwalker] is stale - check driver
May 26 03:29:38 ubuntuserver1 upsd[8689]: Send ping to UPS [powerwalker] failed: Resource temporarily unavailable

@2E0PGS
Copy link

2E0PGS commented May 29, 2018

Whoa my appoligies I noticed you only just cherry picked the commit 20 hours ago or so.

So if it seems sudden to be asking when its going into a release my appologies but hopefull a rough idea if not point me to which branch is best for me to build manually with those changes. Perhaps I will just clone master and modify that line locally myself? But then I maybe missing out on other fixes related to my issue in the libusb branch.

I am running the following system:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial
Kernel: x86_64 Linux 4.4.0-96-generic

The following libusb versions:

sudo apt search libusb | grep installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libusb-0.1-4/xenial,now 2:0.1.12-28 amd64 [installed]
libusb-1.0-0/xenial,now 2:1.0.20-1 amd64 [installed,automatic]

@2E0PGS
Copy link

2E0PGS commented May 29, 2018

It seems others have similair issues which aren't resolved fully: #475

@clepple
Copy link
Member

clepple commented May 29, 2018

@2E0PGS the libusb-1.0+0.1 branch is generally stable (I've been running it for several months with an MGE UPS on FreeBSD), but if the UPS is buggy enough to drop off the USB bus, there may be issues with automatically reconnecting. For Ubuntu, that branch is probably better than master, though as you pointed out, you could also cherry-pick this commit onto master. Given that you have a PowerWalker UPS, it may be better to post some details of your UPS on issue #475 to see how it compares to the model mentioned there.

Closing this PR since the original 250-to-750-ms commit was cherry-picked onto the intended branch.

@clepple clepple closed this May 29, 2018
@stevegilbert23
Copy link
Contributor Author

@clepple - Appreciate you taking the change. It doesn't matter to me but I thought I should mention this in case you are not aware.

Some developers now have goals at their jobs like "Contribute to 3 open source projects per year" and typically the metric used is number of pull requests accepted. In those cases, not accepting a pull request could actually affect someone's compensation. I've also heard (although this is anecdotal) that in some countries, taking a contribution without attribution may be considered theft. I have heard this is one reason for requiring the "signed off" lines.

As I said, it does not affect me; I am just sharing.

@clepple
Copy link
Member

clepple commented May 29, 2018 via email

@2E0PGS
Copy link

2E0PGS commented May 30, 2018

Ok finally running a custom build of branch libusb-1.0+0.1 after a bit of a cufuffle getting it to build on Ubuntu. See comments: #535

Will update on the results.

@2E0PGS
Copy link

2E0PGS commented May 30, 2018

Dammit still happening :P

Broadcast message from nut@ubuntuserver1 (somewhere) (Wed May 30 16:06:43 2018)
                                                                               
UPS powerwalker@localhost is unavailable

upsc powerwalker@localhost output:

Init SSL without certificate database
Error: Data stale

sudo /lib/nut/usbhid-ups -a powerwalker will fix the problem for a short while again or restarting the nut-client also has the same effect. Or infact unplugging and replugging the UPS also works to fix it for a hour or so.

Is there a script I could tap into so when that broadcast message is sent I can have it restart the nut-client service? Sure its a dodgy fix but it maybe the only option for now if alot more work needs to be done to fix compatibility. I do wonder if there is a magic packet that the original software sends which stops the USP from dropping off. I do have USB packet captures of the data between the UPS and it's original software.

I also noted the issue can be related to this: https://unix.stackexchange.com/a/336030 I created such symlink and that is what I use in the config but it makes no difference. Same goes for the restart script in the udev rule since it never gets hit when the device drops comms.

@2E0PGS
Copy link

2E0PGS commented May 30, 2018

That's another idea:

I could poll the upsc powerwalker output and restart the driver if it returns stale.

I am currently playing with pollfrequency at the moment however I'm sure I tried all that before. Worth a try again.

Something I havn't tried before is adjusting DEADTIME and MAXAGE which is what I'm testing now.

@2E0PGS
Copy link

2E0PGS commented May 30, 2018

One thing possibly worth trying is using blazer_ser and/or blazer_usb drivers but I cannot get them to work. Howver it seems this commit: a08a229 from this issue thread #483 may fix that if I try a master build.

Or possibly this commit while sticking with my current driver. networkupstools/nut-ddl@3ceb327

So perhaps a master build and then trying both sets of drivers on that.

@2E0PGS
Copy link

2E0PGS commented Jun 1, 2018

Ok with adjusting the pollfrequency and using a build of the libusb-1.0+0.1 branch it is dropping out much much less. Only once in 24 hours and that did reconnect succesfully milli seconds later.

zykh pushed a commit to zykh/nut that referenced this pull request Aug 13, 2018
… 750 ms to allow more time for UPS response

(cherry picked from commit 5cea18c --@clepple)

Closes: networkupstools#543
Closes: networkupstools#542
@kaminkehrer
Copy link

Hello,
Tell me how long it need to get this update in the official nut, please.
I using a raspberry as nut server. My OS is raspian strech.
For me the easiest is, to have it available in apt-get.

Another idea is, make the timout as config. Than everybody could use what he/she needs.

Thank in advance
kaminkehrer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants