Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sporadic Gradle failure: access-filter.json already exists #626

Open
jeanbisutti opened this issue Sep 30, 2024 · 9 comments · Fixed by #635
Open

Sporadic Gradle failure: access-filter.json already exists #626

jeanbisutti opened this issue Sep 30, 2024 · 9 comments · Fixed by #635
Assignees
Labels
bug Something isn't working

Comments

@jeanbisutti
Copy link

The Native Build Tools Gradle plugin is used in the OpenTelemetry Java instrumentation Github repository.

Sometimes the plugin fails. A failure report example: https://ge.opentelemetry.io/s/2rq2vt7d7bsng/failure?expanded-stacktrace=WyIwLTEtMi0zLTQiXQ#1

The root case:

Caused by: java.nio.file.FileAlreadyExistsException: /tmp/agent-config
at org.graalvm.buildtools.agent.AgentConfiguration.addDefaultAccessFilter(AgentConfiguration.java:156)	
at org.graalvm.buildtools.agent.AgentConfiguration.getAgentCommandLine(AgentConfiguration.java:99)	
at org.gradle.api.internal.provider.ValueSupplier$Present.transform(ValueSupplier.java:519) 

The problem seems to come from the recent changes in the AgentConfiguration class, and released in 0.10.3.

The native agent is not enabled from our build.gradle.kts file or a command line (./gradlew -Pagent). Perhaps some code related to the agent could only be executed if the agent is enabled.

Would you have any workaround to recommend?

Thanks.

@jeanbisutti jeanbisutti added the bug Something isn't working label Sep 30, 2024
@dnestoro dnestoro self-assigned this Oct 7, 2024
@dnestoro
Copy link
Collaborator

dnestoro commented Oct 7, 2024

Please use 0.10.2 version util we fix the problem. Thanks for reporting!

@ghilainm
Copy link

ghilainm commented Dec 10, 2024

I have the same kind of issue with the version 0.10.4. The processAot tasks is run in the context of a multi project Gradle build wih parallel feature enabled. It seems to be not supported. Can you confirm @dnestoro ?

Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of property 'agentOptions'.
	at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:[284](https://gitlab.arhs-developments.com/BPC/acceptorpsp/acceptor-psp-transaction-engine/-/jobs/4750122#L284))
	at org.gradle.api.internal.provider.AbstractProperty.lambda$beforeRead$0(AbstractProperty.java:276)
	at org.gradle.api.internal.provider.ValueState.finalizeOnReadIfNeeded(ValueState.java:139)
	at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:276)
	at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:268)
	at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:162)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.getOrNull(AbstractMinimalProvider.java:105)
	at org.gradle.api.internal.provider.ProviderResolutionStrategy$1.resolve(ProviderResolutionStrategy.java:27)
	at org.gradle.util.internal.DeferredUtil.unpack(DeferredUtil.java:59)
	at org.gradle.util.internal.DeferredUtil.unpackOrNull(DeferredUtil.java:49)
	at org.gradle.api.internal.tasks.properties.InputParameterUtils.prepareInputParameterValue(InputParameterUtils.java:38)
	at org.gradle.api.internal.tasks.properties.InputParameterUtils.prepareInputParameterValue(InputParameterUtils.java:30)
	... 98 more
Caused by: java.lang.RuntimeException: Cannot add default access-filter.json
	at org.graalvm.buildtools.agent.AgentConfiguration.addDefaultAccessFilter(AgentConfiguration.java:180)
	at org.graalvm.buildtools.agent.AgentConfiguration.getAgentCommandLine(AgentConfiguration.java:101)
	at org.gradle.api.internal.provider.ValueSupplier$Present.transform(ValueSupplier.java:519)
	at org.gradle.api.internal.provider.TransformBackedProvider.mapValue(TransformBackedProvider.java:91)
	at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:82)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:115)
	at org.gradle.api.internal.provider.Collectors$ElementsFromCollectionProvider.collectEntries(Collectors.java:280)
	at org.gradle.api.internal.provider.AbstractCollectionProperty$CollectingSupplier.calculateValue(AbstractCollectionProperty.java:500)
	at org.gradle.api.internal.provider.AbstractCollectionProperty.finalValue(AbstractCollectionProperty.java:311)
	at org.gradle.api.internal.provider.AbstractCollectionProperty.finalValue(AbstractCollectionProperty.java:79)
	at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:281)
	... 109 more
Caused by: java.nio.file.FileAlreadyExistsException: /tmp/agent-config/access-filter_71_173383205
	at org.graalvm.buildtools.agent.AgentConfiguration.addDefaultAccessFilter(AgentConfiguration.java:169)
	... 119 more

@ghilainm
Copy link

It seems task are really run in // at the same millisecond :).

            long pid = ProcessHandle.current().pid();
            long time = System.currentTimeMillis();
            Path tmpAccessFilter = agentDir.resolve(ACCESS_FILTER_PREFIX + '_' + pid  + '_' + time  + '_' + ACCESS_FILTER_SUFFIX);
            Files.copy(accessFilterData, tmpAccessFilter);

@dnestoro
Copy link
Collaborator

It seems task are really run in // at the same millisecond :).

Can you please replace milliseconds with nanoseconds in the current implementation and run your tests again to see if the problem still occurs?

@dnestoro
Copy link
Collaborator

dnestoro commented Jan 14, 2025

Hey @jeanbisutti @ghilainm I recently merged a fix for this issue. Can you try if it resolves the problem on your projects?

Since it is already on master, you can build the plugin locally (see this) and apply locally built plugin to your project.

@jeanbisutti
Copy link
Author

@dnestoro I have not reproduced the issue locally. The issue was only observed in a CI. Do you have the possibility to publish a snapshot?

@dnestoro
Copy link
Collaborator

dnestoro commented Jan 14, 2025

@jeanbisutti unfortunately, we don't have possibility to publish snapshots. Let's wait for standard release then, and see if the issue is solved.

Please keep me updated if the issue gets resolved with the incoming release.

@ghilainm
Copy link

@dnestoro Sorry have no time to test that. Can't easily reproduce sporadic issue. But I will upgrade to next version and check if the issue still happens.

@dnestoro
Copy link
Collaborator

@ghilainm thanks! I hope next version (0.10.5) will be released in the incoming weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants