<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">25 Апр 2017 г. 10:23 пользователь "Michal Privoznik" <<a href="mailto:mprivozn@redhat.com">mprivozn@redhat.com</a>> написал:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear list,<br>
<br>
as you might have seen, I've been playing with our streams lately. One of the things I wanted to try was how my sparse streams deal with vol-download and slow writer (e.g. slow disk). Note to whomever wants to try that out: blkio,throttle.write_* is no good for this. So I went the old way:<br>
<br>
diff --git i/tools/virsh-util.c w/tools/virsh-util.c<br>
index 4b86e29..8f5738d 100644<br>
--- i/tools/virsh-util.c<br>
+++ w/tools/virsh-util.c<br>
@@ -149,6 +149,8 @@ virshStreamSink(virStreamPtr st ATTRIBUTE_UNUSED,<br>
 {<br>
     int *fd = opaque;<br>
<br>
+    sleep(60);<br>
+<br>
     return safewrite(*fd, bytes, nbytes);<br>
 }<br>
<br>
<br>
And found out something ugly: the memory footprint of virsh just keeps growing as vol-download progresses. I've tracked down the problem to:<br>
<br>
1) The client event loop (virNetClientIOEventLoop) sees some incoming data, so it reads it (virNetClientIOHandleInput -> virNetClientCallDispatch) and queues the packet (virNetClientCallDispatchStrea<wbr>m) regardless of the length of already queued packets<br>
<br>
2) Since the server sees client has read all the data, it sends even more data.<br>
<br>
<br>
And the queue in step 1) just grows and grows. Ideally, the packets are taken out from the queue by virStreamRecv (which boils down to virNetClientStreamRecvPacket), but that is not on the schedule for the next minute.<br>
<br>
Frankly, I don't have any idea how to fix this. We can stop reading the data (i.e. not set POLLIN on the client <-> server socket) if the queue reaches certain length. BUT, this would mean no other call is processed. Not even keepalive - and the connection would break.<br>
<br>I think breaking connection not bad,simplify  retry with new offset.<br><br><br><br>
The other option is to pretend I've never send this e-mail and you've read nothing O:-)<br>
<br>
Michal<br>
<br>
--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com" target="_blank">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/libvir-list</a><br>
</blockquote></div><br></div></div></div>