b0a335e351
Socket backend read handler should normally perform a disconnect, however
the read handler may not get a chance to run if the frontend is not ready
(qemu_chr_be_can_write() == 0).
This means that in virtio-serial frontend case if
- the host has disconnected (giving EPIPE on socket write)
- and the guest has disconnected (-> frontend not ready -> backend
will not read)
- and there is still data (frontend->backend) to flush (has to be a really
tricky timing but nevertheless, we have observed the case in production)
This results in virtio-serial trying to flush this data continiously forming
a busy loop.
Solution: react on write error in the socket write handler.
errno is not reliable after qio_channel_writev_full(), so we may not get
the exact EPIPE, so disconnect on any error but QIO_CHANNEL_ERR_BLOCK which
io_channel_send_full() converts to errno EAGAIN.
We must not disconnect right away though, there still may be data to read
(see
|
||
---|---|---|
.. | ||
char-console.c | ||
char-fd.c | ||
char-fd.h | ||
char-file.c | ||
char-io.c | ||
char-io.h | ||
char-mux.c | ||
char-mux.h | ||
char-null.c | ||
char-parallel.c | ||
char-parallel.h | ||
char-pipe.c | ||
char-pty.c | ||
char-ringbuf.c | ||
char-serial.c | ||
char-serial.h | ||
char-socket.c | ||
char-stdio.c | ||
char-udp.c | ||
char-win-stdio.c | ||
char-win-stdio.h | ||
char-win.c | ||
char-win.h | ||
char.c | ||
Makefile.objs |