Hyperfoil / qDup

Lab automation and queuing scripting
Apache License 2.0
12 stars 12 forks source link

Using containers causes the java process to hang after the run completes #209

Closed willr3 closed 3 months ago

willr3 commented 3 months ago

The jar does not exit when a host starts a container on either the LOCAL or a remote connection. The run completes, the json server stops, to pod stops, but the process does not exit.

recreate script

scripts:
  foo:
  - sh: uname -a
  - sh: echo "foo" > foo.txt
  - queue-download: foo.txt
  - sh: ls -al
  - sh: date

hosts:
  target:
    local: true
    platform: docker
    container: quay.io/fedora/fedora

roles:
  run:
    hosts: [target]
    setup-scripts:
    - foo
johnaohara commented 3 months ago

Attached are stack traces for 2 different scripts (one is the sample above);

test.jstack.txt kb_qdup.jstack.txt

It appears the Json Server and the LocalShell threads have not been closed down

johnaohara commented 3 months ago
...
"Thread-3" #34 daemon prio=5 os_prio=0 cpu=3.51ms elapsed=543.33s tid=0x00007fb315398ff0 nid=0xbdd2d runnable  [0x00007fb2e0ecc000]
   java.lang.Thread.State: RUNNABLE
        at java.io.FileInputStream.readBytes(java.base@17.0.8.1/Native Method)
        at java.io.FileInputStream.read(java.base@17.0.8.1/FileInputStream.java:276)
        at java.io.BufferedInputStream.read1(java.base@17.0.8.1/BufferedInputStream.java:282)
        at java.io.BufferedInputStream.read(java.base@17.0.8.1/BufferedInputStream.java:343)
        - locked <0x000000060c428ba8> (a java.io.BufferedInputStream)
        at sun.nio.cs.StreamDecoder.readBytes(java.base@17.0.8.1/StreamDecoder.java:270)
        at sun.nio.cs.StreamDecoder.implRead(java.base@17.0.8.1/StreamDecoder.java:313)
        at sun.nio.cs.StreamDecoder.read(java.base@17.0.8.1/StreamDecoder.java:188)
        - locked <0x000000061b609c38> (a java.io.InputStreamReader)
        at java.io.Reader.read(java.base@17.0.8.1/Reader.java:197)
        at java.io.InputStreamReader.read(java.base@17.0.8.1/InputStreamReader.java:157)
        at java.util.Scanner.readInput(java.base@17.0.8.1/Scanner.java:882)
        at java.util.Scanner.findWithinHorizon(java.base@17.0.8.1/Scanner.java:1796)
        at java.util.Scanner.hasNextLine(java.base@17.0.8.1/Scanner.java:1610)
        at io.hyperfoil.tools.qdup.JsonServer.lambda$start$1(JsonServer.java:196)
        at io.hyperfoil.tools.qdup.JsonServer$$Lambda$462/0x00007fb28c603370.run(Unknown Source)
        at java.lang.Thread.run(java.base@17.0.8.1/Thread.java:833)

...

"Thread-6" #78 prio=5 os_prio=0 cpu=2.01ms elapsed=419.57s tid=0x00007fb120010610 nid=0xbe32a runnable  [0x00007fb2d6dfe000]
   java.lang.Thread.State: RUNNABLE
        at java.io.FileInputStream.readBytes(java.base@17.0.8.1/Native Method)
        at java.io.FileInputStream.read(java.base@17.0.8.1/FileInputStream.java:276)
        at java.io.BufferedInputStream.read1(java.base@17.0.8.1/BufferedInputStream.java:282)
        at java.io.BufferedInputStream.read(java.base@17.0.8.1/BufferedInputStream.java:343)
        - locked <0x0000000615735de8> (a java.lang.ProcessImpl$ProcessPipeInputStream)
        at io.hyperfoil.tools.qdup.shell.LocalShell.lambda$connectShell$0(LocalShell.java:77)
        at io.hyperfoil.tools.qdup.shell.LocalShell$$Lambda$549/0x00007fb28c65a570.run(Unknown Source)
        at java.lang.Thread.run(java.base@17.0.8.1/Thread.java:833)
...