|
From: | Eric Blake |
Subject: | Re: [PATCH for-5.0?] nbd: Attempt reconnect after server error of ESHUTDOWN |
Date: | Thu, 2 Apr 2020 08:41:31 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 4/2/20 3:38 AM, Richard W.M. Jones wrote:
On Wed, Apr 01, 2020 at 05:38:41PM -0500, Eric Blake wrote:I was trying to test qemu's reconnect-delay parameter by using nbdkit as a server that I could easily make disappear and resume. A bit of experimenting shows that when nbdkit is abruptly killed (SIGKILL), qemu detects EOF on the socket and manages to reconnect just fine; but when nbdkit is gracefully killed (SIGTERM), it merely fails all further guest requests with NBD_ESHUTDOWN until the client disconnects first, and qemu was blindly failing the I/O request with ESHUTDOWN from the server instead of attempting to reconnect. While most NBD server failures are unlikely to change by merely retrying the same transaction, our decision to not start a retry loop in the common case is correct. But NBD_ESHUTDOWN is rare enough, and really is indicative of a transient situation, that it is worth special-casing.
For the case I care about (long running virt-v2v conversions with an intermittent network) we don't expect that nbdkit will be killed nor gracefully shut down. Instead what we expect is that nbdkit returns an error such as NBD_EIO and keeps running. Indeed if nbdkit actually dies then reconnecting will not help since there will be no server to reconnect to.
Hmm. The idea of reconnect-delay in qemu is that if the connection to the server is dropped, we try to reconnect and then retry the I/O operation. Maybe what we want is an nbdkit filter which turns EIO errors from the v2v plugin into forced server connection drops, but leave nbdkit up and running to allow the next client to connect. That's different from the existing --filter=retry behavior (where we try to keep the client connection alive and reopen the plugin), but has a similar effect (because we force the connection to the client to drop, the client would have to reconnect to get more data, and reconnecting triggers a retry on connecting to the plugin). And it's different from --filter=exitlast (that says to quit nbdkit altogether, rather than just the current connection with a client).
So I'm neutral about this patch. If you want it for qemu that's fine but I don't think it will affect v2v.
Then this patch is no longer 5.0 material. We may still want to improve shutdown handling in qemu (both in the client and in the server), but doing it correctly will be bigger than just one patch, based on Vladimir's response.
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |