I have a large Java desktop (non-Android) project with many submodules, and I recently started trying to get it to build and run on Windows 10. (Normally I run builds on MacOS.)
We consistently get an error when trying to run the tests; this error happens on the Windows 10 machines from myself and also other developers on the project, starting from a fresh checkout of the code.
Here is the error:
2020-11-09T18:21:51.995-0800 [INFO] [org.gradle.internal.snapshot.impl.DirectorySnapshotter] Could not read file path 'C:\Users\Me\myproject\.gradle\6.6.1\executionHistory\executionHistory.lock'.
Immediately after the error in the --debug
logs is the following stack trace; I don't know if it's related, but it appears after every appearance of the error above:
java.io.UncheckedIOException: Failed to create MD5 hash for file content.
at org.gradle.internal.hash.DefaultStreamHasher.hash(DefaultStreamHasher.java:37)
at org.gradle.internal.hash.DefaultFileHasher.hash(DefaultFileHasher.java:41)
at org.gradle.api.internal.changedetection.state.CachingFileHasher.snapshot(CachingFileHasher.java:87)
at org.gradle.api.internal.changedetection.state.CachingFileHasher.hash(CachingFileHasher.java:69)
at org.gradle.api.internal.changedetection.state.SplitFileHasher.hash(SplitFileHasher.java:54)
at org.gradle.internal.snapshot.impl.DirectorySnapshotter$PathVisitor.snapshotFile(DirectorySnapshotter.java:281)
at org.gradle.internal.snapshot.impl.DirectorySnapshotter$PathVisitor.visitResolvedFile(DirectorySnapshotter.java:260)
at org.gradle.internal.snapshot.impl.DirectorySnapshotter$PathVisitor.visitFile(DirectorySnapshotter.java:238)
at org.gradle.internal.snapshot.impl.DirectorySnapshotter$PathVisitor.visitFile(DirectorySnapshotter.java:173)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2804)
at org.gradle.internal.snapshot.impl.DirectorySnapshotter.snapshot(DirectorySnapshotter.java:73)
at org.gradle.internal.vfs.impl.DefaultVirtualFileSystem.snapshot(DefaultVirtualFileSystem.java:146)
at org.gradle.internal.vfs.impl.DefaultVirtualFileSystem.lambda$readLocation$15(DefaultVirtualFileSystem.java:166)
at java.base/java.util.Optional.orElseGet(Optional.java:362)
at org.gradle.internal.vfs.impl.DefaultVirtualFileSystem.lambda$readLocation$16(DefaultVirtualFileSystem.java:166)
at org.gradle.internal.vfs.impl.DefaultVirtualFileSystem$StripedProducerGuard.guardByKey(DefaultVirtualFileSystem.java:203)
at org.gradle.internal.vfs.impl.DefaultVirtualFileSystem.lambda$readLocation$17(DefaultVirtualFileSystem.java:165)
at java.base/java.util.Optional.orElseGet(Optional.java:362)
at org.gradle.internal.vfs.impl.DefaultVirtualFileSystem.readLocation(DefaultVirtualFileSystem.java:165)
at org.gradle.internal.vfs.impl.DefaultVirtualFileSystem.read(DefaultVirtualFileSystem.java:64)
at org.gradle.internal.vfs.RoutingVirtualFileSystem.read(RoutingVirtualFileSystem.java:53)
at org.gradle.internal.fingerprint.impl.DefaultFileCollectionSnapshotter$SnapshottingVisitor.visitCollection(DefaultFileCollectionSnapshotter.java:61)
at org.gradle.api.internal.file.AbstractOpaqueFileCollection.visitContents(AbstractOpaqueFileCollection.java:55)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.collections.UnpackingVisitor.visitSingleFile(UnpackingVisitor.java:108)
at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:103)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection$UnresolvedItemsCollector.visitContents(DefaultConfigurableFileCollection.java:380)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.visitChildren(DefaultConfigurableFileCollection.java:292)
at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.UnionFileCollection.visitChildren(UnionFileCollection.java:78)
at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.UnionFileCollection.visitChildren(UnionFileCollection.java:78)
at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.UnionFileCollection.visitChildren(UnionFileCollection.java:78)
at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:61)
at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:86)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection$UnresolvedItemsCollector.visitContents(DefaultConfigurableFileCollection.java:380)
at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.visitChildren(DefaultConfigurableFileCollection.java:292)
at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:61)
at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:86)
at org.gradle.api.internal.file.DefaultFileCollectionFactory$ResolvingFileCollection.visitChildren(DefaultFileCollectionFactory.java:310)
at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
at org.gradle.api.internal.tasks.PropertyFileCollection.visitChildren(PropertyFileCollection.java:48)
at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:326)
at org.gradle.internal.fingerprint.impl.DefaultFileCollectionSnapshotter.snapshot(DefaultFileCollectionSnapshotter.java:50)
at org.gradle.internal.fingerprint.impl.AbstractFileCollectionFingerprinter.fingerprint(AbstractFileCollectionFingerprinter.java:47)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.lambda$visitInputFileProperties$1(ExecuteActionsTaskExecuter.java:327)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$fingerprintInputFiles$3(CaptureStateBeforeExecutionStep.java:192)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.visitInputFileProperties(ExecuteActionsTaskExecuter.java:325)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.fingerprintInputFiles(CaptureStateBeforeExecutionStep.java:188)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.captureExecutionState(CaptureStateBeforeExecutionStep.java:150)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$captureExecutionStateOp$1(CaptureStateBeforeExecutionStep.java:104)
at org.gradle.internal.execution.steps.BuildOperationStep$1.call(BuildOperationStep.java:40)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.internal.execution.steps.BuildOperationStep.operation(BuildOperationStep.java:37)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.captureExecutionStateOp(CaptureStateBeforeExecutionStep.java:103)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$execute$0(CaptureStateBeforeExecutionStep.java:78)
at java.base/java.util.Optional.map(Optional.java:258)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:78)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
at java.base/java.util.Optional.orElseGet(Optional.java:362)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:195)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:187)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at java.base/java.io.FileInputStream.readBytes(Native Method)
at java.base/java.io.FileInputStream.read(FileInputStream.java:249)
at org.gradle.internal.hash.DefaultStreamHasher.doHash(DefaultStreamHasher.java:52)
at org.gradle.internal.hash.DefaultStreamHasher.hash(DefaultStreamHasher.java:35)
... 124 more
I also see errors about reading other files:
2020-11-09T18:21:51.998-0800 [INFO] [org.gradle.internal.snapshot.impl.DirectorySnapshotter] Could not read file path 'C:\Users\Me\myproject\.gradle\6.6.1\fileContent\fileContent.lock'.
(the above is followed by an identical pair of exceptions about the MD5 hash and some other process locking a portion of the file)
2020-11-09T18:21:52.029-0800 [INFO] [org.gradle.internal.snapshot.impl.DirectorySnapshotter] Could not read file path 'C:\Users\Me\myproject\.gradle\6.6.1\fileHashes\fileHashes.lock'.
(same)
Note that the entire project builds and runs correctly on Windows 10. This is only a problem running the tests. But I'd love to get it resolved so that the Windows devs can run them.
I've tried the following things, none of which worked.
- Fresh checkout of the project on different machines
- Removing the project's
.gradle
folder and clean rebuilding - sacrificing a very small goat
At first I thought the error might be caused by some failing tests (I had some integration tests that didn't run on Windows 10), but after disabling those, I (and my teammates) still get the error.
Note that a very similar question was asked, in context of building inside a Docker container: OSError: Can not read file in context: \\?\C:\project\.gradle\6.6.1\executionHistory\executionHistory.lock
However, we are not building inside Docker containers, and the solution above did not work for us. I am building in a VirtualBox Windows 10 guest VM on a Mac OS Catalina host, and my teammate who is also seeing the error is building on a Windows 10 laptop. No Docker is involved here.
I welcome ideas on how to help diagnose this problem further. Note that it will be impractical to try to narrow it down to a small sample repro case, because of the size and ancient-ness of the project.
Aucun commentaire:
Enregistrer un commentaire