setup-java icon indicating copy to clipboard operation
setup-java copied to clipboard

Post Setup JDK 17 takes very long time on local runner

Open MartynasObdeleven opened this issue 1 year ago • 6 comments

Description: I have a build script that is run on each PR. It launches appium test suite, which takes approximately 4 minutes to complete, but after that Post Setup JDK 17 takes more than 10 minutes which is strange, since we're using m1 mac studio. Job looks like:

name: Appium Tests

on:
  push:
    branches:
      - "develop"
  pull_request:
    branches:
      - "main"
      - "develop"

jobs:
  appium-tests:
    runs-on: [self-hosted, macOS, ARM64]

    steps:
      - uses: actions/[email protected]

      - name: Set up JDK 17
        uses: actions/[email protected]
        with:
          java-version: '17'
          distribution: 'zulu'
          cache: gradle

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew

      - name: Appium Tests (E2E)
        run: |
          chmod +x run_offline_appium_tests.sh
          ./run_offline_appium_tests.sh
        working-directory: scripts

Here's timeline: image

Task version: 4.3.0

Platform:

  • [ ] Ubuntu
  • [x ] macOS
  • [ ] Windows

Runner type:

  • [ ] Hosted
  • [ x] Self-hosted

Expected behavior: Post Setup takes no more than minute.

Actual behavior: Post Setup takes 10+ minutes.

MartynasObdeleven avatar Sep 11 '24 05:09 MartynasObdeleven

Hello @MartynasObdeleven, Thank you for creating this issue and we will look into it :)

aparnajyothi-y avatar Sep 12 '24 12:09 aparnajyothi-y

v3 is also very slow with JDK 17. Is the cache size Ok?

choppeh avatar Sep 16 '24 16:09 choppeh

I removed cache: gradle and the step was quickly completed

choppeh avatar Sep 16 '24 17:09 choppeh

I had setup java on local machine so it runs fine with:

name: Appium Tests

on:
  push:
    branches:
      - "develop"
  pull_request:
    branches:
      - "main"
      - "develop"

jobs:
  appium-tests:
    runs-on: [self-hosted, macOS, ARM64]

    steps:
      - uses: actions/[email protected]

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew

      - name: Appium Tests (E2E)
        run: |
          chmod +x run_offline_appium_tests.sh
          ./run_offline_appium_tests.sh
        working-directory: scripts

MartynasObdeleven avatar Sep 17 '24 11:09 MartynasObdeleven

Hello @MartynasObdeleven, Thank you for bringing this issue to our attention. It appears that the post-setup step for JDK 17 is taking an unusually long time, even though the Appium test suite completes in about 4 minutes. Here are a few points to consider:

1.It looks like the cache size in your workflow is around 6GB (~6353 MB). This could be the reason why the "Post Setup JDK 17" step is taking more than 10 minutes to complete, especially since you're using an M1 Mac Studio, which should be quite fast.

2.To verify if the cache is causing the delay, I recommend running the same workflow without caching. You can do this by removing the cache configuration from the actions/setup-java step. This will help determine if the cache is indeed the factor slowing down the process. If the steps complete more quickly without the cache, you may need to optimize the caching strategy.

If the issue persists, kindly provide us with more detailed logs or a public repository to facilitate further investigation.

mahalakshmi-rekadi avatar Sep 20 '24 04:09 mahalakshmi-rekadi

Hello @MartynasObdeleven, @mahalakshmi-rekadi @choppeh,

I've also encountered this issue with the "Post Setup JDK 17" step taking a long time due to the large cache size (~6GB). After removing the cache: gradle configuration, the step completed much faster.

I'll try optimizing the cache, but removing it completely for now seems to be the best workaround.

My Recommendation

  1. Remove Cache: As suggested by @choppeh, removing the cache: gradle from the setup-java step might solve the problem. It was reported to significantly reduce the time for the "Post Setup JDK 17" step.

    `

  • name: Set up JDK 17 uses: actions/[email protected] with: java-version: '17' distribution: 'zulu'

    cache: gradle # <--- Try commenting this out

`

  1. Cache Optimization: If removing the cache resolves the issue, you might need to revise the caching strategy. Perhaps only caching essential Gradle directories or reducing the frequency of cache uploads could help without removing the cache entirely.

Further Steps:

  1. Run the Workflow without Cache: Test the workflow by removing the cache configuration as suggested to see if it resolves the delay in the post-setup step.

  2. Provide Detailed Logs: If the issue persists, consider sharing more detailed logs or a sample public repository with the maintainers to help further investigate the root cause.

srinivasboga avatar Sep 22 '24 13:09 srinivasboga

Hello @MartynasObdeleven, We are awaiting for your response on the issue. Please let us know if we can close this issue if there are no further queries.

mahalakshmi-rekadi avatar Oct 03 '24 13:10 mahalakshmi-rekadi

Hello @MartynasObdeleven, Due to inactivity i'm going to close this issue for now .Please feel free to reopen this issue or create a new one if necessary. Thank you.

mahalakshmi-rekadi avatar Oct 15 '24 14:10 mahalakshmi-rekadi