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

Clean up dummy-ups code, behavior and logs; added NUT_DEBUG_PID option #2118

Merged
merged 21 commits into from
Oct 19, 2023

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Oct 18, 2023

This PR started as an investigation into occasional NIT (NUT Integration Test) script failures, and so far stumbled on a number of imperfections in the dummy-ups driver - so started with those.

Updated with NIT test-script fixes as well.

NOTE: Strange behavior noted on WSL2 Ubuntu builds (maybe the VM is just slow now) that both upsd and dummy-ups daemons logged stuff in bursts separated by roughly 10 sec, and those logs took a while to appear on display. There seemed to be a considerable delay between driver start, and readiness, and socket creation, and upsd connection to that socket, and DUMPALL request, and lots of info streaming until DUMPDONE marker - took about a minute overall for that test case initialization, and almost 3 min for the script. On other systems it goes at 1 sec cadence and all test cases complete in 20 sec.

UPDATE: Yeah, a laggy VM, huge load average with no real CPU load - nothing a wsl --shutdown could not fix.

To make sense of that wall of text, added NUT_DEBUG_PID optional envvar support to OPTIONALLY log with non-zero debug level and PIDs, like:

[D5:21086] send_to_all: SETINFO driver.state "cleanup.exit"

instead of plain

[D5] send_to_all: SETINFO driver.state "cleanup.exit"

This allows NIT mixed log from 4 daemons to be better understandable (adding a name might be better?) and I suppose can help systems that run all NUT programs as one logged bundle - e.g. containers like HA plugins - without a syslog/journal that would add identifiers to each line.

…based dummy-ups; check for invalid FD for good measure (to avoid fstat() on that)

Signed-off-by: Jim Klimov <[email protected]>
…y short "device_path" to stat the paths

Signed-off-by: Jim Klimov <[email protected]>
@jimklimov jimklimov added enhancement CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) labels Oct 18, 2023
@jimklimov jimklimov added this to the 2.8.1 milestone Oct 18, 2023
…x_start_drivers() if debugging

Signed-off-by: Jim Klimov <[email protected]>
…tching expression and explain why

Signed-off-by: Jim Klimov <[email protected]>
…include PID number in debug-level identifiers

Signed-off-by: Jim Klimov <[email protected]>
@jimklimov jimklimov changed the title Clean up dummy-ups code, behavior and logs Clean up dummy-ups code, behavior and logs; added NUT_DEBUG_PID option Oct 18, 2023
@AppVeyorBot
Copy link

…; revise upsd stopping after testcase_upsd_allow_no_device()

Signed-off-by: Jim Klimov <[email protected]>
* report why a test case failed sanity-checks;
* avoid grep output spilling to test log to avoid confusion;
* revise that exactly expected port count was seen (that was the confusion);
* use log_*() in that sanity-check block

Signed-off-by: Jim Klimov <[email protected]>
@AppVeyorBot
Copy link

@jimklimov jimklimov merged commit ff24189 into networkupstools:master Oct 19, 2023
3 of 4 checks passed
@jimklimov jimklimov deleted the nit-warn branch October 19, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants