Gradle build on GitLab CI: Could not create service of type ScriptPluginFactory
up vote
0
down vote
favorite
Using parallel Gradle jobs on GitLab CI:

I'm receiving following random Gradle exception:
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeScopeServices.createResourceSnapshotterCacheService().
I use a docker executor of gitlab-runner without any GitLab CI caching. I use a Docker volume instead with Gradle cache pointing to that volume:
before_script:
- export GRADLE_USER_HOME=/pipelines/.gradle
There is no issue with access rights to the /pipelines directory (so it's not duplicity of this question).
Simple, but annoying workaround to this issue is just to re-trigger the failed job manually - then it passes without any problem. Another workaround could to re-trigger the job automatically via the retry directive.
So, my question is: What is causing the job failure and how to solve it (without job re-triggering)?
docker gradle gitlab-ci gitlab-ci-runner
add a comment |
up vote
0
down vote
favorite
Using parallel Gradle jobs on GitLab CI:

I'm receiving following random Gradle exception:
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeScopeServices.createResourceSnapshotterCacheService().
I use a docker executor of gitlab-runner without any GitLab CI caching. I use a Docker volume instead with Gradle cache pointing to that volume:
before_script:
- export GRADLE_USER_HOME=/pipelines/.gradle
There is no issue with access rights to the /pipelines directory (so it's not duplicity of this question).
Simple, but annoying workaround to this issue is just to re-trigger the failed job manually - then it passes without any problem. Another workaround could to re-trigger the job automatically via the retry directive.
So, my question is: What is causing the job failure and how to solve it (without job re-triggering)?
docker gradle gitlab-ci gitlab-ci-runner
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Using parallel Gradle jobs on GitLab CI:

I'm receiving following random Gradle exception:
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeScopeServices.createResourceSnapshotterCacheService().
I use a docker executor of gitlab-runner without any GitLab CI caching. I use a Docker volume instead with Gradle cache pointing to that volume:
before_script:
- export GRADLE_USER_HOME=/pipelines/.gradle
There is no issue with access rights to the /pipelines directory (so it's not duplicity of this question).
Simple, but annoying workaround to this issue is just to re-trigger the failed job manually - then it passes without any problem. Another workaround could to re-trigger the job automatically via the retry directive.
So, my question is: What is causing the job failure and how to solve it (without job re-triggering)?
docker gradle gitlab-ci gitlab-ci-runner
Using parallel Gradle jobs on GitLab CI:

I'm receiving following random Gradle exception:
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeScopeServices.createResourceSnapshotterCacheService().
I use a docker executor of gitlab-runner without any GitLab CI caching. I use a Docker volume instead with Gradle cache pointing to that volume:
before_script:
- export GRADLE_USER_HOME=/pipelines/.gradle
There is no issue with access rights to the /pipelines directory (so it's not duplicity of this question).
Simple, but annoying workaround to this issue is just to re-trigger the failed job manually - then it passes without any problem. Another workaround could to re-trigger the job automatically via the retry directive.
So, my question is: What is causing the job failure and how to solve it (without job re-triggering)?
docker gradle gitlab-ci gitlab-ci-runner
docker gradle gitlab-ci gitlab-ci-runner
asked Nov 7 at 9:11
Vít Kotačka
420419
420419
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
Root cause:
After some debugging (switches --stacktrace and --info), it's obvious that the root cause is that multiple Docker containers are sharing one Gradle cache on the host machine.
Caused by: org.gradle.cache.LockTimeoutException: Timeout waiting to lock file hash cache (/pipelines/.gradle/caches/4.10.2/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 158
Our PID: 160
Owner Operation:
Our operation:
Lock file: /pipelines/.gradle/caches/4.10.2/fileHashes/fileHashes.lock
Solution:
There is still unsolved Gradle bug/feature: Let multiple containers share downloaded dependencies. Therefore I (re)implemented proper Gradle caching per each involved GitLab CI job (so, no shared cache 😢):
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
rpmClient:
stage: buildRpm
script:
- gradle clientRpm
cache:
paths:
- .gradle/caches
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Root cause:
After some debugging (switches --stacktrace and --info), it's obvious that the root cause is that multiple Docker containers are sharing one Gradle cache on the host machine.
Caused by: org.gradle.cache.LockTimeoutException: Timeout waiting to lock file hash cache (/pipelines/.gradle/caches/4.10.2/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 158
Our PID: 160
Owner Operation:
Our operation:
Lock file: /pipelines/.gradle/caches/4.10.2/fileHashes/fileHashes.lock
Solution:
There is still unsolved Gradle bug/feature: Let multiple containers share downloaded dependencies. Therefore I (re)implemented proper Gradle caching per each involved GitLab CI job (so, no shared cache 😢):
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
rpmClient:
stage: buildRpm
script:
- gradle clientRpm
cache:
paths:
- .gradle/caches
add a comment |
up vote
1
down vote
Root cause:
After some debugging (switches --stacktrace and --info), it's obvious that the root cause is that multiple Docker containers are sharing one Gradle cache on the host machine.
Caused by: org.gradle.cache.LockTimeoutException: Timeout waiting to lock file hash cache (/pipelines/.gradle/caches/4.10.2/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 158
Our PID: 160
Owner Operation:
Our operation:
Lock file: /pipelines/.gradle/caches/4.10.2/fileHashes/fileHashes.lock
Solution:
There is still unsolved Gradle bug/feature: Let multiple containers share downloaded dependencies. Therefore I (re)implemented proper Gradle caching per each involved GitLab CI job (so, no shared cache 😢):
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
rpmClient:
stage: buildRpm
script:
- gradle clientRpm
cache:
paths:
- .gradle/caches
add a comment |
up vote
1
down vote
up vote
1
down vote
Root cause:
After some debugging (switches --stacktrace and --info), it's obvious that the root cause is that multiple Docker containers are sharing one Gradle cache on the host machine.
Caused by: org.gradle.cache.LockTimeoutException: Timeout waiting to lock file hash cache (/pipelines/.gradle/caches/4.10.2/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 158
Our PID: 160
Owner Operation:
Our operation:
Lock file: /pipelines/.gradle/caches/4.10.2/fileHashes/fileHashes.lock
Solution:
There is still unsolved Gradle bug/feature: Let multiple containers share downloaded dependencies. Therefore I (re)implemented proper Gradle caching per each involved GitLab CI job (so, no shared cache 😢):
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
rpmClient:
stage: buildRpm
script:
- gradle clientRpm
cache:
paths:
- .gradle/caches
Root cause:
After some debugging (switches --stacktrace and --info), it's obvious that the root cause is that multiple Docker containers are sharing one Gradle cache on the host machine.
Caused by: org.gradle.cache.LockTimeoutException: Timeout waiting to lock file hash cache (/pipelines/.gradle/caches/4.10.2/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 158
Our PID: 160
Owner Operation:
Our operation:
Lock file: /pipelines/.gradle/caches/4.10.2/fileHashes/fileHashes.lock
Solution:
There is still unsolved Gradle bug/feature: Let multiple containers share downloaded dependencies. Therefore I (re)implemented proper Gradle caching per each involved GitLab CI job (so, no shared cache 😢):
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
rpmClient:
stage: buildRpm
script:
- gradle clientRpm
cache:
paths:
- .gradle/caches
edited Nov 7 at 13:39
answered Nov 7 at 13:28
Vít Kotačka
420419
420419
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186389%2fgradle-build-on-gitlab-ci-could-not-create-service-of-type-scriptpluginfactory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown