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

FileAlreadyExistsException in mono repo with multiple plugins #1861

Open
fp7 opened this issue Jan 10, 2025 · 0 comments
Open

FileAlreadyExistsException in mono repo with multiple plugins #1861

fp7 opened this issue Jan 10, 2025 · 0 comments
Labels

Comments

@fp7
Copy link

fp7 commented Jan 10, 2025

What happened?

In mono repos and parallel gradle builds there is a concurrency issue.
The function

private fun writeIvyModule(group: String, artifact: String, version: String, artifactPath: Path?, block: () -> IvyModule): IvyModule {
is not thread safe and multiple threads can try to create the same ivymodule file at the same time which leads to exceptions.

Relevant log output or stack trace

Caused by: java.nio.file.FileAlreadyExistsException: /home/finn/dev/projects/mono/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.impl-IC-243.21565.193.xml
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:379)
        at java.base/java.nio.file.Files.createFile(Files.java:657)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.writeIvyModule(IntelliJPlatformDependenciesHelper.kt:1166)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.collectDependencies(IntelliJPlatformDependenciesHelper.kt:836)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.access$collectDependencies(IntelliJPlatformDependenciesHelper.kt:60)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper$collectDependencies$2$1.invoke(IntelliJPlatformDependenciesHelper.kt:840)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper$collectDependencies$2$1.invoke(IntelliJPlatformDependenciesHelper.kt:836)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.writeIvyModule(IntelliJPlatformDependenciesHelper.kt:1162)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.collectDependencies(IntelliJPlatformDependenciesHelper.kt:836)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.collectDependencies$default(IntelliJPlatformDependenciesHelper.kt:808)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper$createIntelliJPlatformBundledPlugin$2.invoke(IntelliJPlatformDependenciesHelper.kt:777)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper$createIntelliJPlatformBundledPlugin$2.invoke(IntelliJPlatformDependenciesHelper.kt:769)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.writeIvyModule(IntelliJPlatformDependenciesHelper.kt:1162)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.createIntelliJPlatformBundledPlugin(IntelliJPlatformDependenciesHelper.kt:769)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper.access$createIntelliJPlatformBundledPlugin(IntelliJPlatformDependenciesHelper.kt:60)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper$addIntelliJPlatformBundledPluginDependencies$$inlined$cachedListProvider$IntelliJPlatformGradlePlugin$1.call(IntelliJPlatformDependenciesHelper.kt:137)
        at org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper$addIntelliJPlatformBundledPluginDependencies$$inlined$cachedListProvider$IntelliJPlatformGradlePlugin$1.call(IntelliJPlatformDependenc22 actionable tasks: 4 executed, 18 up-to-date
iesHelper.kt:123)
        at org.gradle.api.internal.provider.DefaultProvider.calculateOwnValue(DefaultProvider.java:73)

Steps to reproduce

Run ./gradlew dependencies in a project with multiple intellij plugins and parallel builds enabled.
If necessary I will try to create a reproducer, but as this is a concurrency issue, it is hard to produce reliably and from the code I think it is pretty much clear that it can happen.

Gradle IntelliJ Plugin version

2.2.1

Gradle version

8.12

Operating System

Linux

Link to build, i.e. failing GitHub Action job

No response

@fp7 fp7 added the bug label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant