-
Notifications
You must be signed in to change notification settings - Fork 74
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
silence rsync progress in harv-install #641
Conversation
Because this is running without a TTY, it may be affecting IPMI-based installs that take hours to read the zst files off of virtual media. This patch removes the progress flag from rsync in the hopes that it prevents rsync from freezing during install.
Thanks for the contribution! |
Hi @petiepooo Would you elaborate more on the problem you encountered? Do you mean mounting the ISO image via BMC will cause installation progress to become stuck if those rsync flags are on? Thank you! |
Installation via BMC virtual optical disc is still hanging for me when installing via BMC console on a slow link. Like 2.4GHz WiFi-slow. What I've done to get around it is to ssh into the install, wait for the second rsync command to be running, and run Without that, the installation just seems to hang after several minutes. I know that's been addressed once in #2651, but I believe unsuccessfully. Rsync is normally good at running long syncs in the background, but when trying an installation that is unsuccessful, I no longer see a high volume of traffic between the browser with the ISO mounted and the iDRAC port 5900. It seems to stop part way through rsync of the second image. Sending any sort of signal, such as HUP or USR1, to rsync kills it and harv-install exits with an error. My working theory is that with --progress present, rsync is sending data to stdout, but the reading process is blocking while waiting for a line feed. Because no LF is sent until the file is 100% transferred (progress output includes ANSI codes but no LF), the stdio buffer is filling up and rsync is blocking waiting on room in its stdio buffer. Removing the --progress indicator would decrease output to stdout, thereby preventing that blocking... I believe. Note that this only applies to really long rsync sessions, such as transferring that 1.9GB image file over a 240Kbps 802.11g WiFi link. When I ran that killall/md5sync/killall sequence, it took nearly two hours to come back with all five md5 hashes. However, with the source files already cached after that, the rsync completed quickly, as it was just copying them out to local disk then. Again, rsync blocking on stdio is just a theory, however when running harv-install via the ISO installer, rsync progress is not displayed on the console anyway, so the --progress flag is moot. Removing it would not decrease the output sent to the IPMI console. |
Perhaps there's a way to only disable the --progress output if it's not being sent to a TTY. Or perhaps figure out how to not line-buffer its output so that progress is displayed on the BMC console... that would be even better, but is beyond my skill level. At least, please try to duplicate the rsync freeze using 2.4GHz WiFi for your virtual optical disc BMC link, and if you can then see if removing the --progress fixes it. |
I don't have real hardware to try this on via IPMI, but I've simulated a very slow ISO install in a VM, and can confirm that the Same if I check /var/log/console.log:
i.e. all the progress output is batched up and dumped once the rsync is finished. I'll see if I can figure out how to not buffer this stuff so we can get better console output, but if that fails I'm totally happy to take this - thanks for the PR! |
I left my very slow ISO install running overnight, and when I came back in the morning it was still sitting there part way through an rsync (the console was the same as the screenshot in my previous comment). So I did some more detailed testing today. For the record, I was installing harvester in a VM, but I'd capped the speed of the virtual CD-ROM to 1MB/s. Here's the relevant libvirt config snippet:
While
It prints out one of those progress lines every second. After it had been running for about half an hour, it just stopped dead. My record of the duration here is:
The last line logged to the console showed it starting to copy harvester-images-v1.2.1.tar.zst. After that it did harvester-repo-images-v1.2.1.tar.zst and then it got part way through rancher-images-v2.7.5.tar.zst before locking up. Comparing the start time from the log (07:17:35) with the mtime on the last file (08:07:28) gives 50 minutes. Note that the length of most progress lines printed in the I also re-ran the install after removing To see if I could fix the progress display I experimented a bit with Here's where we invoke harvester-installer/pkg/console/util.go Line 522 in 5e98567
The harvester-installer/pkg/console/util.go Lines 398 to 406 in 5e98567
Note that we're using bufio.Scanner.Scan, which by default will read line-by-line, splitting on I'm going to open a separate issue for enhancing the
OTOH... Do we really care about logging how fast these transfers are? WDYT @starbops, @bk201? |
I'm glad to hear you were able to reproduce it, and that the PR as written resolves it. I'm ok with updating rsync options from |
@tserong Thanks for the write-up. It pointed out the root cause very clearly. I'm wondering if the
|
@starbops I've now tested both
...but there's no additional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petiepooo Thank you for the contribution! There's just one nit that needs your help. Please see the following.
rsync -ah --progress ${ISOMNT}/bundle/harvester/images/rke2-images.*.tar.zst $TARGET/$RKE2_IMAGES_DIR | ||
rsync -a ${ISOMNT}/bundle/harvester/images/rke2-images.*.tar.zst $TARGET/$RKE2_IMAGES_DIR | ||
echo "Copying remaining images temporary location..." | ||
rsync -ah --progress ${ISOMNT}/bundle/harvester/images/ $TARGET/$TMP_IMAGES_DIR | ||
rsync -ah --progress ${ISOMNT}/bundle/harvester/images-lists/ $TARGET/$IMAGES_LISTS_DIR | ||
rsync -a ${ISOMNT}/bundle/harvester/images/ $TARGET/$TMP_IMAGES_DIR | ||
rsync -a ${ISOMNT}/bundle/harvester/images-lists/ $TARGET/$IMAGES_LISTS_DIR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be helpful if you could add the missing -hv
flags for rsync calls. Thank you!
Human-readable and verbose flags added per developer request.
Done. Thank you both for your work on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you! @petiepooo
@Mergifyio backport v1.2 |
✅ Backports have been created
|
* silent rsync progress in harv-install Because this is running without a TTY, it may be affecting IPMI-based installs that take hours to read the zst files off of virtual media. This patch removes the progress flag from rsync in the hopes that it prevents rsync from freezing during install. * restore -h and add -v flags Human-readable and verbose flags added per developer request. (cherry picked from commit d6947e0)
* silent rsync progress in harv-install Because this is running without a TTY, it may be affecting IPMI-based installs that take hours to read the zst files off of virtual media. This patch removes the progress flag from rsync in the hopes that it prevents rsync from freezing during install. * restore -h and add -v flags Human-readable and verbose flags added per developer request. (cherry picked from commit d6947e0)
Problem:
Because this is running without a TTY, it may be affecting IPMI-based installs that take hours to read the zst files off of virtual media.
Solution:
This patch removes the progress flag from rsync in the hopes that it prevents rsync from freezing during install.
Related Issue:
harvester/harvester#2651
Test plan:
Test install on slow IPMI virtual media