<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 2022-05-15 12:07, Laine Stump wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:0284f7d2-46ae-a0cb-ae68-9d96e14365ba@redhat.com">On
      5/15/22 11:48 AM, Digimer wrote:
      <br>
      <blockquote type="cite">Hi all,
        <br>
        <br>
           I've got a series of programs that monitor various things on
        a CentOS Stream 8 VM host. All of these scripts work when called
        directly. However, when I have a parent program that calls all
        the little programs in series, I found that some virsh calls
        hang.
        <br>
      </blockquote>
      <br>
      Is your script being called from a libvirt "hook" script?
      (<a class="moz-txt-link-freetext" href="https://libvirt.org/hooks.html">https://libvirt.org/hooks.html</a> )If so, that won't work - a
      libvirt hook script is called from within libvirt, and can't call
      back into libvirt.
      <br>
      <br>
      Other than that, is there anything different about the context the
      script is being run from vs. the context you're directly running
      virsh from?
      <br>
    </blockquote>
    <p>It's a perl script making a shell (system) call. So it's
      basically;</p>
    <p>open (my $fh, "/usr/bin/virsh list --all |") or die;<br>
      while ($fh)<br>
      {<br>
          chomp;<br>
          # Do things<br>
      }<br>
      close $fh;<br>
    </p>
    <p>  There's about 15 programs that are sitting in a given
      directory. When the parent program runs, it looks at the scripts
      in the directory and runs them (again as simple shell calls), one
      after the other. This is where things fail. I'm happy to provide
      more detail or add debugging if you'd like.<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
      cite="mid:0284f7d2-46ae-a0cb-ae68-9d96e14365ba@redhat.com">
      <br>
      <blockquote type="cite">
        <br>
           Initially, there were two scripts that were hanging
        repeatedly. Once called 'virsh net-list --all --name', so I
        changed it to check for configs in
        '/etc/libvirt/qemu/networks/', and that script started working.
        The other script though calls 'virsh list --all', and that can't
        be easily swapped out, so I really need to find the source of
        these hangs.
        <br>
        <br>
           Whenever the hang happens, about 30~45 seconds later, I see
        'libvirtd[1643714]: Cannot recv data: Connection reset by peer'.
        <br>
        <br>
           I think the issue is striking other scripts that run, but
        this scenario is happening predictably and consistently right
        now.
        <br>
        <br>
           I thought it might be a concurrent connect limit or a problem
        with how many times virsh is called by a script, so I wrote a
        test script that kept calling 'virsh list --all' each second,
        but it was close to 100 calls without hanging, far more that all
        the calls in my scripts combined, so I don't think that's it.
        <br>
        <br>
        Any advice/guidance would be very much appreciated!
        <br>
        <br>
        -- <br>
        Digimer
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>