Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8327946

containers/docker/TestJFREvents.java fails when host kernel config vm.swappiness=0 after JDK-8325139

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • 23
    • hotspot
    • 23
    • b19
    • generic
    • generic

      If the kernel config vm.swappiness=0, the testcase containers/docker/TestJFREvents.java fails: 'totalSize = 104857600' missing from stdout/stderr

      > sudo swapon --show ; free -h ; cat /etc/os-release ; uname -a ; sudo sysctl -a | grep swap -i
                    total used free shared buff/cache available
      Mem: 187Gi 5.1Gi 67Gi 95Mi 115Gi 180Gi
      Swap: 0B 0B 0B
      NAME="Alibaba Cloud Linux"
      VERSION="3 (Soaring Falcon)"
      ID="alinux"
      ID_LIKE="rhel fedora centos anolis"
      VERSION_ID="3"
      UPDATE_ID="9"
      PLATFORM_ID="platform:al8"
      PRETTY_NAME="Alibaba Cloud Linux 3 (Soaring Falcon)"
      ANSI_COLOR="0;31"
      HOME_URL="https://www.aliyun.com/"

      Linux j66e07344.sqa.eu95 5.10.134-16.1.al8.x86_64 #1 SMP Thu Dec 7 14:11:24 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
      vm.swappiness = 0

      test command:
      rm -rf tmp ; jtreg -w tmp -nr -v:fail,error test/hotspot/jtreg/containers/docker/TestJFREvents.java
      cd tmp/scratch
      docker build --no-cache --tag jdk-internal:test jdk-internal-test-containers-docker-TestJFREvents-jfr-events
      cd ../..
      export CLASSPATH=$PWD/tmp/classes/containers/docker/TestJFREvents.d
      docker run --pids-limit -1 --network host --privileged -h docker -u $(id -u ${USER}):$(id -g ${USER}) -w $HOME -v /etc/group:/etc/group:ro -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro --rm -it -v $HOME:$HOME -e CLASSPATH=$CLASSPATH --name jtreg -w $PWD --memory=200m --memory-swap=300m jdk-internal:test java JfrReporter jdk.SwapSpace


      testcase fail message:
      STDERR:
       stdout: [===== EventType: jdk.SwapSpace
      startTime = 699024071
      totalSize = 0
      freeSize = 0
      ===== EventType: jdk.SwapSpace
      startTime = 699480132
      totalSize = 0
      freeSize = 0
      ];
       stderr: []
       exitValue = 0

      java.lang.RuntimeException: 'totalSize = 104857600' missing from stdout/stderr
              at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:252)
              at TestJFREvents.testSwapMemory(TestJFREvents.java:226)
              at TestJFREvents.main(TestJFREvents.java:73)

      If we add docker run parameter --memory-swappiness=60, then the jfr output contains the expected message: "totalSize = 104857600"

      According to the docker document(https://docs.docker.com/config/containers/resource_constraints/#--memory-swappiness-details), the default value of --memory-swappiness is inherited from the host machine.
      So, when the the kervnel config vm.swappiness=0 on the host machine, this testcase will fail, because of docker container can not use swap memory, the deafult value of --memory-swappiness is 0.

            syan Sendao Yan
            syan Sendao Yan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: