<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Ok, so following a bit on this. I'll summarize some of our
      findings, some of them maybe obvious for some people in this list.<br>
    </p>
    I saw that there are actually two different kind of VMs for *nix [1]
    :<br>
     - threaded heartbeat<br>
     - itimer + signal heartbeat<br>
      <br>
    Specially, I'd like to cite the following paragraph for the lazy:<br>
    <br>
    <blockquote>A distinction on linux is between VMs with an itimer
      hearbeat or a threaded
      heartbeat. VMs with an itimer hearbeat use setitimer to deliver a
      SIGALRM
      signal at regular intervals to interrupt the VM to check for
      events. These
      signals can be troublesome, interrupting foreign code that cannot
      cope with
      such signals. VMs with a threaded heartbeat use a high-priority
      thread that
      loops, blocking on nanosleep and then interrupting the VM,
      performing the same
      function as the itimer heartbeat but without using signals. These
      VMs are to
      be preferred but suport for multiple thread priorities in
      user-level processes has only been available on linux in kernels
      later than 2.6.12.<br>
      <br>
    </blockquote>
    So, I downloaded the heartbeat squeak VM from bintray [2]. This VM
    requires so deploy some configuration files in /etc/security [2].<br>
    <br>
    Under this configuration OSSubprocess worked like a charm (or I did
    not found the issue again so far).<br>
    <br>
    Now, this heartbeat threaded VM is the recommended in the README
    file, and we see that OSSubprocess generates the exact issue stated.
    The main problem remains for the moment since Pharo's default
    download includes not this VM but the itimer one. I talked with
    Esteban about it and he was aware of these two VM flavours, and the
    reason why we are using the itimer one is the need to deploy those
    permission files in /etc, which makes installation a bit less
    automatic.<br>
    <br>
    Cheers,<br>
    Guille<br>
    <br>
    [1]
<a class="moz-txt-link-freetext" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/e17db79411cfec767e04f3d94d12a642d920a30e/build.linux64x64/HowToBuild">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/e17db79411cfec767e04f3d94d12a642d920a30e/build.linux64x64/HowToBuild</a><br>
    [2]
<a class="moz-txt-link-freetext" href="https://bintray.com/opensmalltalk/vm/download_file?file_path=cog_linux32x86_squeak.sista.spur_201612170124.tar.gz">https://bintray.com/opensmalltalk/vm/download_file?file_path=cog_linux32x86_squeak.sista.spur_201612170124.tar.gz</a><br>
    [3]
<a class="moz-txt-link-freetext" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/r3732#linux">https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/r3732#linux</a><br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <br>
    <div class="moz-cite-prefix">-------- Original Message --------<br>
    </div>
    <blockquote cite="mid:op.yssf34eonn7ecr@frown-black-2.local"
      type="cite"><br>
      <br>
      <blockquote type="cite">I asked Santa an OSSubprocess that won't
        hang :)<br>
        <br>
      </blockquote>
      <br>
      <br>
      I really appreciate to see such not so small polar elfves helping
      santa :)<br>
      <br>
      <br>
      <br>
      Stef<br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <blockquote type="cite">Thanks,<br>
        <br>
        Guille<br>
        <br>
        <br>
        <br>
        <br>
        <br>
        -------- Original Message --------<br>
        <br>
        <blockquote type="cite"><br>
          <br>
          <blockquote type="cite">On 19 Dec 2016, at 14:41, Mariano
            Martinez Peck <a class="moz-txt-link-rfc2396E" href="mailto:marianopeck@gmail.com"><marianopeck@gmail.com></a> wrote:<br>
            <br>
            <br>
            <br>
            Hi guys,<br>
            <br>
            <br>
            <br>
            Guille Polito kept one of these images if someone can give
            us a hand. He also proposed the great idea of using `strace`
            to see what was going on. He  (together with Pable Tesone)
            suspected that the heartbeat could be interrupting the
            `clone()` function which is (I think) called internally by
            the 'posix_spawn()' which is the one used by OSSubprocess.<br>
            <br>
            <br>
            <br>
            When these images are "hung" they found at a infinitive loop
            like this:<br>
            <br>
          </blockquote>
          Okay, how many child processes do you have at that point? How
          many processes does the system have?<br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <blockquote type="cite">[pid 17477] --- SIGALRM
            {si_signo=SIGALRM, si_code=SI_KERNEL} ---<br>
            <br>
            [pid 17477] gettimeofday({1482152630, 593498}, NULL) = 0<br>
            <br>
            [pid 17477] sigreturn() (mask [])       = 120<br>
            <br>
            [pid 17477] clone(child_stack=0,
            flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
            child_tidptr=0xf7578768) = ? ERESTARTNOINTR (To be
            restarted)<br>
            <br>
            [pid 17477] --- SIGALRM {si_signo=SIGALRM,
            si_code=SI_KERNEL} ---<br>
            <br>
            [pid 17477] gettimeofday({1482152630, 600126}, NULL) = 0<br>
            <br>
            [pid 17477] sigreturn() (mask [])       = 120<br>
            <br>
            [pid 17477] clone(child_stack=0,
            flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
            child_tidptr=0xf7578768) = ? ERESTARTNOINTR (To be
            restarted)<br>
            <br>
          </blockquote>
          so above.. 7ms between the two gettimeofday calls? Nothing
          else? Set a breakpoint on clone/fork in gdb and look at the
          c-stack at this point? Could you strace with timestamps to see
          how much time is spent? Is the process suspicious in other
          ways?<br>
          <br>
          <br>
          <br>
          So yes.. sounds like clone doesn't complete.. the question is
          why? Is it out of resources? Is something in the VM blocking
          longer than the heartbeat, is the heartbeat more frequent than
          expected?<br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <blockquote type="cite">As you can see, there is a SIGALARM
            involved. It also looks like the `gettimeofday` is used by
            the heartbeat ?  Could it be that someone the heartbeat is
            interrupting the `clone()` ?<br>
            <br>
            <br>
            <br>
            Guille also showed me the `strace` output with a regular /
            working image:<br>
            <br>
            <br>
            <br>
            <br>
            <br>
            [pid 18647] --- SIGALRM {si_signo=SIGALRM,
            si_code=SI_KERNEL} ---<br>
            <br>
            [pid 18647] gettimeofday({1482152829, 481014}, NULL) = 0<br>
            <br>
            [pid 18647] sigreturn() (mask [])       = -1 EINTR
            (Interrupted system call)<br>
            <br>
            [pid 18647] getitimer(ITIMER_REAL, {it_interval={0, 2000},
            it_value={0, 1917}}) = 0<br>
            <br>
            [pid 18647] recvmsg(3, 0xff7b0734, 0)   = -1 EAGAIN
            (Resource temporarily unavailable)<br>
            <br>
            [pid 18647] select(4, [3], [], [3], {0, 1000}) = 0 (Timeout)<br>
            <br>
            [pid 18647] getitimer(ITIMER_REAL, {it_interval={0, 2000},
            it_value={0, 797}}) = 0<br>
            <br>
            [pid 18647] recvmsg(3, 0xff7b0734, 0)   = -1 EAGAIN
            (Resource temporarily unavailable)<br>
            <br>
            [pid 18647] select(4, [3], [], [3], {0, 1000}) = ?
            ERESTARTNOHAND (To be restarted if no handler)<br>
            <br>
            [pid 18647] --- SIGALRM {si_signo=SIGALRM,
            si_code=SI_KERNEL} ---<br>
            <br>
            <br>
            <br>
            <br>
            <br>
            Does anyone have any hint here?<br>
            <br>
          </blockquote>
          Get timestamps in there. How long does it take to fail/end in
          this situation?<br>
          <br>
          <br>
          <br>
          holger<br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
        </blockquote>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
      </blockquote>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
    </blockquote>
    <br>
    <br>
  </body>
</html>