[Pkg-libvirt-commits] [Git][libvirt-team/libvirt][debian/latest] 2 commits: patches: Add backport/tests-fix-hang-in-virshtest-read-big-pipe-case.patch
Andrea Bolognani (@abologna)
gitlab at salsa.debian.org
Wed May 8 23:51:29 BST 2024
Andrea Bolognani pushed to branch debian/latest at Libvirt Packaging Team / libvirt
Commits:
aa7ed207 by Andrea Bolognani at 2024-05-08T23:58:20+02:00
patches: Add backport/tests-fix-hang-in-virshtest-read-big-pipe-case.patch
Fixes FTBFS.
- - - - -
170de30b by Andrea Bolognani at 2024-05-09T00:03:51+02:00
Document changes and release 10.3.0-3
- - - - -
3 changed files:
- debian/changelog
- + debian/patches/backport/tests-fix-hang-in-virshtest-read-big-pipe-case.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libvirt (10.3.0-3) unstable; urgency=medium
+
+ * [aa7ed20] patches: Add backport/tests-fix-hang-in-virshtest[...]
+ - Fixes FTBFS
+
+ -- Andrea Bolognani <eof at kiyuko.org> Thu, 09 May 2024 00:03:19 +0200
+
libvirt (10.3.0-2) unstable; urgency=medium
* [13f1f61] patches: Add backport/vsh-Don-t-init-history[...]
=====================================
debian/patches/backport/tests-fix-hang-in-virshtest-read-big-pipe-case.patch
=====================================
@@ -0,0 +1,82 @@
+From: =?utf-8?b?IkRhbmllbCBQLiBCZXJyYW5nw6ki?= <berrange at redhat.com>
+Date: Wed, 8 May 2024 11:50:09 +0100
+Subject: tests: fix hang in virshtest 'read-big-pipe' case
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+The virshtest program testPipeFeeder method is doing this:
+
+ mkfifo("test.fifo", 0600) ;
+
+ int fd = open("test.fifo", O_RDWR);
+
+ char buf[...];
+ memset(buf, 'a', sizeof(buf));
+ write(fd, buf, sizeof(buf)) == sizeof(buf));
+ close(fd);
+
+while the the 'virsh' child process then ends up doing:
+
+ fd = open("test.fifo", O_RDONLY);
+ read(fd, buf, sizeof(buf)) == sizeof(buf));
+ close(fd);
+
+The 'virsh' code hangs on open() on at least ppc64 and some other
+arches. It can be provoked to hang even on x86 by reducing the size of
+the buffer. It can be prevented from hanging on ppc64 by increasing the
+size of the buffer.
+
+What is happening is a result of differing page sizes, altering the
+overall pipe capacity size, since pipes on linux default to 16 pages
+in size and thus have architecture specific capacity when measured
+in bytes.
+
+ * On x86, testPipeFeeder opens R+W, tries to write 140kb and
+ write() blocks because the pipe is full. This gives time for
+ virsh to start up, and it can open the pipe for O_RDONLY
+ since testPipeFeeder still has it open for write. Everything
+ works as intended.
+
+ * On ppc64, testPipeFeeder opens R+W, tries to write 140kb
+ and write() succeeds because the larger 64kb page size
+ resulted in greater buffer capacity for the pipe. It thus
+ quickly closes the pipe, removing the writer, and triggering
+ discard of all the unread data. Now virsh starts up, tries
+ to open the pipe for O_RDONLY and blocks waiting for a new
+ writer to open it, which will never happen. Meson kills
+ the test after 30 seconds.
+
+ NB, every now & then, it will not block because virsh starts
+ up quickly enough that testPipeFeeder has not yet closed the
+ write end of the pipe, giving the illusion of correctness.
+
+The key flaw here is that it should not have been using O_RDWR
+in testPipeFeeder. Synchronization is required such that both
+virsh and testPipeFeeder have their respective ends of the pipe
+open before any data is sent. This is trivially arranged by
+using O_WRONLY in testPipeFeeder.
+
+Reviewed-by: Andrea Bolognani <abologna at redhat.com>
+Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
+(cherry picked from commit e1c32120ce6eddb72272b4717dd8384075b32c2f)
+
+Forwarded: not-needed
+Origin: https://gitlab.com/libvirt/libvirt/-/commit/e1c32120ce6eddb72272b4717dd8384075b32c2f
+---
+ tests/virshtest.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/virshtest.c b/tests/virshtest.c
+index a1ae481..7a77976 100644
+--- a/tests/virshtest.c
++++ b/tests/virshtest.c
+@@ -145,7 +145,7 @@ testPipeFeeder(void *opaque)
+ g_autofree char *doc = g_new0(char, emptyspace + xmlsize + 1);
+ VIR_AUTOCLOSE fd = -1;
+
+- if ((fd = open(pipepath, O_RDWR)) < 0) {
++ if ((fd = open(pipepath, O_WRONLY)) < 0) {
+ fprintf(stderr, "\nfailed to open pipe '%s': %s\n", pipepath, g_strerror(errno));
+ return;
+ }
=====================================
debian/patches/series
=====================================
@@ -1,5 +1,6 @@
backport/rpc-ensure-temporary-GSource-is-removed-from-client-event.patch
backport/vsh-Don-t-init-history-in-cmdComplete.patch
+backport/tests-fix-hang-in-virshtest-read-big-pipe-case.patch
forward/Reduce-udevadm-settle-timeout-to-10-seconds.patch
debian/Debianize-libvirt-guests.patch
debian/apparmor_profiles_local_include.patch
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt/-/compare/2c59f2b539ec8be405abbb049995646bc02971d6...170de30b7e129d0b6fa79da73bfbe91e93277798
--
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt/-/compare/2c59f2b539ec8be405abbb049995646bc02971d6...170de30b7e129d0b6fa79da73bfbe91e93277798
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20240508/a1ab66b1/attachment-0001.htm>
More information about the Pkg-libvirt-commits
mailing list