The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6389
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === This is just a hunch as to the possible cause of the race condition in rsync.Recv. I believe the function go be exiting early (because the 2 synchronisation channels are filled with an error value) meaning the Recv function exists before the go routines, and in the situation where the Recv function is called immediately afterwards (when transferring multiple volume snapshots) and using a new wrapper of WebsocketIO (with its own lock) this could cause multiple writers to the parent websocket conn concurrently. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From b9cfe585305106359d0333e8950a072a08d5dbd0 Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Sat, 2 Nov 2019 19:03:57 +0000 Subject: [PATCH] lxd/rsync: Tweaks Recv's internal synchronisation to avoid race Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/rsync/rsync.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lxd/rsync/rsync.go b/lxd/rsync/rsync.go index d9ac02fcd3..d5d0ee1320 100644 --- a/lxd/rsync/rsync.go +++ b/lxd/rsync/rsync.go @@ -276,9 +276,9 @@ func Recv(path string, conn io.ReadWriteCloser, tracker *ioprogress.ProgressTrac chCopyRsync := make(chan error, 1) go func() { _, err := io.Copy(conn, stdout) - chCopyRsync <- err stdout.Close() conn.Close() // sends barrier message. + chCopyRsync <- err }() // Forward from source to rsync. @@ -298,8 +298,8 @@ func Recv(path string, conn io.ReadWriteCloser, tracker *ioprogress.ProgressTrac chCopySource := make(chan error, 1) go func() { _, err := io.Copy(stdin, readSourcePipe) - chCopySource <- err stdin.Close() + chCopySource <- err }() stderr, err := cmd.StderrPipe()
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel