Endless FileLock when Testing with the Android eumlator on CircleCI

Hi everyone :slight_smile:
I got some issue when I test on Android emulator with gradle.

Has anyone seen this error?
I tried to reproduce this error, but does not happen.

This issue may be a temporary issue but, I want to know why this happened.
Here are the logs and my workflow goes on 2 hours until I stop by myself.

2021-06-02T06:06:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:06:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:06:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:06:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:06:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:06:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:06:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:06:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:06:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:06:53.724+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:06:53.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:06:53.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:06:53.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:06:53.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:06:53.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:03.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:03.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:03.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:03.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:03.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:03.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:13.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:13.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:13.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:13.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:13.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:13.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:23.724+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:23.724+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:23.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:23.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:23.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:23.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:33.724+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:33.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:43.724+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-06-02T06:07:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-06-02T06:07:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-06-02T06:07:43.725+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
... (endless)

And here is the my circle ci config.

version: 2

android_machine_ubuntu: &android_machine_ubuntu
  working_directory: ~/circleci-caver-java-android
  machine:
    image: android:202102-01
  resource_class: large

setup_android_test_files: &setup_android_test_files
  run:
    name: "Setup android instrumented test environment"
    command: |
        bash .circleci/setup_android_instrumented_test.sh

pull_klaytn_image: &pull_klaytn_image
  run:
    name: "Pull and tag Klaytn image"
    command: |
        docker pull klaytn/build_base:latest
        docker image tag klaytn/build_base:latest klaytn

check_test_network: &check_test_network
  run:
    name: "Check test network"
    command: |
        MAXRETRY=600
        RETRY=0
        while [ $RETRY -lt $MAXRETRY ]
        do
            if curl --fail -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"rpc_modules","params":[],"id":1}' http://localhost:8551 2>/dev/null; then
                echo "Klaytn RPC server is up"
                break
            else
                echo "wait for Klyatn RPC server..."
                sleep 5
            fi
            RETRY=$(($RETRY+5))
        done
        if [ $RETRY -eq $MAXRETRY ]; then
            echo "failed to connect Klaytn RPC server"
            exit 1
        fi

build_test_android: &build_test_android
  run:
    name: "Build without unit tests and do instrumented test on Android Emulator"
    no_output_timeout: 20m
    command: |
      ./gradlew clean
      ./gradlew build --debug -x :android_instrumented_test:build -x test
      ./gradlew connectedDebugAndroidTest --debug --stacktrace

  android_build:
    <<: *android_machine_ubuntu
    steps:
      - checkout
      - *setup_android_test_files
      - *pull_klaytn_image
      - *start_test_network
      - *check_test_network
      - run:
          name: Create avd
          command: |
            SYSTEM_IMAGES="system-images;android-29;default;x86"
            sdkmanager "$SYSTEM_IMAGES"
            echo "no" | avdmanager --verbose create avd -n test -k "$SYSTEM_IMAGES"
      - run:
          name: Launch emulator
          command: |
            emulator -avd test -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
          background: true
      - run:
          name: Wait for emulator to start
          command: |
            circle-android wait-for-boot
      - run:
          name: Disable emulator animations
          command: |
            adb shell settings put global window_animation_scale 0.0
            adb shell settings put global transition_animation_scale 0.0
            adb shell settings put global animator_duration_scale 0.0
      - *build_test_android
      - store_test_results:
          path: android_instrumented_test/build/outputs/androidTest-results/connected
      - persist_to_workspace:
          root: ~/
          paths: 
            - circleci-caver-java-android/*

Here is the more detailed info about my environment.

Below is the repo what I tested.

If you need more information to investigate this problem,
please let me know.