On Fri, Nov 15, 2024 at 01:55:53PM -0600, Eric Blake wrote:
> While testing the use of qemu-nbd in a Pod of a Kubernetes cluster, I
> got LOTS of log messages of the forms:
> 
> qemu-nbd: option negotiation failed: Failed to read flags: Unexpected 
> end-of-file before all data were read
> qemu-nbd: option negotiation failed: Failed to read flags: Unable to read 
> from socket: Connection reset by peer
> 
> While it is nice to warn about clients that aren't following protocol
> (in case it helps diagnosing bugs in those clients), a mere port probe
> (where the client never write()s any bytes, and where we might even
> hit EPIPE in trying to send our greeting to the client) is NOT
> abnormal, but merely serves to pollute the log.  And Kubernetes
> _really_ likes to do port probes to determine whether a given Pod is
> up and running.
> 
> Easy ways to demonstrate the above port probes:
> $ qemu-nbd -r -f raw path/to/file &
> $ nc localhost 10809 </dev/null
> $ bash -c 'exec </dev/tcp/localhost/10809'
> $ kill $!
> 
> Silence the noise by not capturing errors until after our first
> successful read() from a client.
> 
> Signed-off-by: Eric Blake <ebl...@redhat.com>
> ---
>  nbd/server.c | 26 +++++++++++++++++---------
>  1 file changed, 17 insertions(+), 9 deletions(-)

In testing this as a potential candidate for -rc1, I'm seeing iotests
failures in `./check 094 119 -nbd` both pre- and post-patch.
Bisecting now to see if I can find where those tests started
regressing (looks like a timing change; a "return" line is swapping
place with a SHUTDOWN event line in the QMP output).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org


Reply via email to