[PATCH] qemu: Do not report eof when processing monitor IO

Jim Fehlig jfehlig at suse.com
Fri Oct 15 17:33:18 UTC 2021


On 10/15/21 01:22, Michal Prívozník wrote:
> On 10/15/21 1:53 AM, Jim Fehlig wrote:
>> There have been countless reports from users concerned about the following
>> error reported by libvirtd when qemu domains are shutdown
>>
>> internal error: End of file from qemu monitor
>>
>> While the error is harmless, users often mistaken it for real problem with
>> their deployments. EOF from the monitor can't be entirely ignored since
>> other threads may be using the monitor and must be able to detect the EOF
>> condition.
>>
>> One potential fix is to delay reporting EOF until the monitor is used
>> after EOF is detected. This patch adds a 'goteof' member to the
>> qemuMonitor structure, which is set when EOF is detected on the monitor
>> socket. If another thread later tries to send data on the monitor, the
>> EOF error is reported.
>>
>> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>> ---
>>
>> First non-RFC version of the patch. RFC version can be found here
>>
>> https://listman.redhat.com/archives/libvir-list/2021-October/msg00484.html
>>
>> Tests mentioned in the below post are running on this version of the
>> patch and have completed 12 iterations thus far
>>
>> https://listman.redhat.com/archives/libvir-list/2021-October/msg00351.html
>>
>>   src/qemu/qemu_monitor.c | 28 +++++++++++++++-------------
>>   1 file changed, 15 insertions(+), 13 deletions(-)
>>
>> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
>> index 7ff6a1161f..434cc26c10 100644
>> --- a/src/qemu/qemu_monitor.c
>> +++ b/src/qemu/qemu_monitor.c
>> @@ -113,6 +113,7 @@ struct _qemuMonitor {
>>   
>>       /* true if qemu no longer wants 'props' sub-object of object-add */
>>       bool objectAddNoWrap;
>> +    bool goteof;
> 
> Nit pick - sorry for not raising this earlier, but this placement feels
> a bit weird. The goteof has nothing to do with objectAddNoWrap member.
> Can you please move it a few lines up? Somewhere around lastError or
> waitGreeting - that place looks better.

No problem. I added the below diff before pushing. Thanks helping get this small 
yet annoying cosmetic issue resolved!

Cheers,
Jim

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 434cc26c10..e8accaf2b0 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -98,6 +98,9 @@ struct _qemuMonitor {
       * the next monitor msg */
      virError lastError;

+    /* Set to true when EOF is detected on the monitor */
+    bool goteof;
+
      int nextSerial;

      bool waitGreeting;
@@ -113,7 +116,6 @@ struct _qemuMonitor {

      /* true if qemu no longer wants 'props' sub-object of object-add */
      bool objectAddNoWrap;
-    bool goteof;
  };

  /**





More information about the libvir-list mailing list