setup-java post action caching for v4 is slower than v3 · Issue #601 · actions/setup-java · GitHub
Skip to content

setup-java post action caching for v4 is slower than v3 #601

Description

@htpaf

Description:
When switching from setup-java v3 to v4 the post run part is significantly slower.

Task version:
v4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:

Slow:

jobs:
  verify:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-java@v4
        with:
          java-version: '11'
          distribution: 'temurin'
          cache: 'maven'
      - name: run maven
        run: |
          mvn -B --settings .mvn/settings.xml verify
        shell: bash

image


Fast:

jobs:
  verify:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-java@v3
        with:
          java-version: '11'
          distribution: 'temurin'
          cache: 'maven'
      - name: run maven
        run: |
          mvn -B --settings .mvn/settings.xml verify
        shell: bash

image

Expected behavior:
v4 should have the same speed as v3.
Both executions had no cache hits and the amount of data was approx 30MB.

Actual behavior:
v4 is in this case orders of magnitude slower than v3.

Additional information:

I have seen that actions setup-node actions/setup-node#878
and setup-ruby ruby/setup-ruby#543 have had the same problem.
It seems that it had to do with the upgrade of the actions/cache version.

I think their solution was to exit the process manually after caching is complete as otherwise the job simply hangs until some timeout.

After looking at this repo for a very short time my guess is that perhaps somewhere
here ->


a process.exit(0) could solve the problem (as I said, I'm only guessing based on the node and ruby solutions).

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions