Skip to content

Support for concurrent operations - P2 operation already in progress #146

@blacelle

Description

@blacelle

This issue relates (in term of context) with diffplug/spotless#1687

Through Spotless, I end needing to run concurrent P2 invocations in the same environment. It fails with:

Caused by: com.diffplug.spotless.ThrowingEx$WrappedAsRuntimeException: java.io.IOException: Failed to load eclipse jdt formatter: java.lang.IllegalStateException: P2 operation already in progress, close other clients or delete stale lockfile at /tmp/cleanthat/user_home/.m2/repository/dev/equo/p2-data/repository/dev/equo/p2-data/metadata/.lock
--
at com.diffplug.spotless.ThrowingEx.asRuntime(ThrowingEx.java:92)
at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:58)
at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:88)
at com.diffplug.spotless.Formatter.compute(Formatter.java:246)
at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:203)
at eu.solven.cleanthat.spotless.SpotlessSession.doStuff(SpotlessSession.java:109)
at eu.solven.cleanthat.language.spotless.SpotlessLintFixer.lambda$doFormat$0(SpotlessLintFixer.java:55)
... 18 common frames omitted
Caused by: java.io.IOException: Failed to load eclipse jdt formatter: java.lang.IllegalStateException: P2 operation already in progress, close other clients or delete stale lockfile at /tmp/cleanthat/user_home/.m2/repository/dev/equo/p2-data/repository/dev/equo/p2-data/metadata/.lock
at com.diffplug.spotless.extra.EquoBasedStepBuilder.get(EquoBasedStepBuilder.java:109)
at com.diffplug.spotless.FormatterStepImpl.calculateState(FormatterStepImpl.java:58)
at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:56)
... 23 common frames omitted
Caused by: java.lang.IllegalStateException: P2 operation already in progress, close other clients or delete stale lockfile at /tmp/cleanthat/user_home/.m2/repository/dev/equo/p2-data/repository/dev/equo/p2-data/metadata/.lock
at dev.equo.solstice.p2.LockFile.lambda$new$0(LockFile.java:37)
at dev.equo.solstice.p2.FileMisc.retry(FileMisc.java:101)
at dev.equo.solstice.p2.LockFile.<init>(LockFile.java:31)
at dev.equo.solstice.p2.P2Client.<init>(P2Client.java:65)
at dev.equo.solstice.p2.P2Model.queryRaw(P2Model.java:94)
at dev.equo.solstice.p2.P2Model.query(P2Model.java:125)
at com.diffplug.spotless.extra.EquoBasedStepBuilder.get(EquoBasedStepBuilder.java:107)
... 25 common frames omitted

This is recurrent in my use-case as I run multiple Spotless|P2 processes on the same machine.

I have no equivalent issue with maven, which handles smoothly concurrent invocations on a common/shared ~/.m2/repository directory. Which makes me feel P2 could/should cover the same useCase.

I would be fine if concurrent operations were kept pending until the lock is freed, instead of hard-failing. This may be a relevant optional behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions