java.io.IOException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

When you iterate over the lines of a scala.io.Source with source.getLines, make sure you do not close the source until you processed the iterator.


rprp

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Generating a backup in Fisheye is failing with: {noformat} 2013-08-15 18:58:00,425 WARN [ThreadPool3 ] fisheye BackupManagerImpl$2-run - Backup failed. java.io.IOException: The process cannot access the file because another process has locked a portion of the file at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:242) at com.cenqua.fisheye.io.IOHelper.copyStream(IOHelper.java:98) at com.cenqua.fisheye.io.IOHelper.copyStream(IOHelper.java:87) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:64) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:55) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:55) at com.atlassian.crucible.migration.item.FileSaver.addPath(FileSaver.java:25) at com.atlassian.crucible.migration.item.FishEyeCacheBackup$SaverImpl.backup(FishEyeCacheBackup.java:104) at com.atlassian.crucible.migration.BackupManagerImpl.createBackup(BackupManagerImpl.java:260) at com.atlassian.crucible.migration.BackupManagerImpl.access$000(BackupManagerImpl.java:54) at com.atlassian.crucible.migration.BackupManagerImpl$2$1.perform(BackupManagerImpl.java:152) at com.atlassian.crucible.maintenance.MaintenanceManager.doMaintenance(MaintenanceManager.java:108) at com.atlassian.crucible.migration.BackupManagerImpl$2.run(BackupManagerImpl.java:150) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) {noformat} A restart does not help. There are no repositories that are running initial indexing at the moment.
    via by Gurleen Anand [Atlassian],
  • Generating a backup in Fisheye is failing with: {noformat} 2013-08-15 18:58:00,425 WARN [ThreadPool3 ] fisheye BackupManagerImpl$2-run - Backup failed. java.io.IOException: The process cannot access the file because another process has locked a portion of the file at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:242) at com.cenqua.fisheye.io.IOHelper.copyStream(IOHelper.java:98) at com.cenqua.fisheye.io.IOHelper.copyStream(IOHelper.java:87) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:64) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:55) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:55) at com.atlassian.crucible.migration.item.FileSaver.addPath(FileSaver.java:25) at com.atlassian.crucible.migration.item.FishEyeCacheBackup$SaverImpl.backup(FishEyeCacheBackup.java:104) at com.atlassian.crucible.migration.BackupManagerImpl.createBackup(BackupManagerImpl.java:260) at com.atlassian.crucible.migration.BackupManagerImpl.access$000(BackupManagerImpl.java:54) at com.atlassian.crucible.migration.BackupManagerImpl$2$1.perform(BackupManagerImpl.java:152) at com.atlassian.crucible.maintenance.MaintenanceManager.doMaintenance(MaintenanceManager.java:108) at com.atlassian.crucible.migration.BackupManagerImpl$2.run(BackupManagerImpl.java:150) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) {noformat} A restart does not help. There are no repositories that are running initial indexing at the moment.
    via by Gurleen Anand [Atlassian],
  • Copy files to rootDir in Gradle
    via Stack Overflow by stuff22
    ,
  • Lock on Hot Backup
    via GitHub by thiagopm
    ,
  • The backup client reports the following error: {noformat} 2014-08-02 02:00:44,927 ERROR (53%) Error writing tar file entry: The process cannot access the file because another process has locked a portion of the file java.io.IOException: The process cannot access the file because another process has locked a portion of the file at java.io.FileInputStream.readBytes(Native Method) ~[na:1.7.0_60] at java.io.FileInputStream.read(FileInputStream.java:272) ~[na:1.7.0_60] ... 13 more frames available in the log file 2014-08-02 02:00:44,973 ERROR (53%) Failed to close tar file entry: entry 'shared/.lock' closed at '0' before the '15' bytes specified in the header were written java.io.IOException: entry 'shared/.lock' closed at '0' before the '15' bytes specified in the header were written at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.closeArchiveEntry(TarArchiveOutputStream.java:363) ~[commons-compress-1.5.jar:1.5] at com.atlassian.stash.internal.backup.client.extensions.TarExtensions.withEntry(TarExtensions.groovy:31) ~[stash-backup-core-1.3.0.jar:na] ... 9 more frames available in the log file {noformat} This .lock file is created and held by Stash itself to prevent multiple instances from running with this shared-home. The .lock file should have been excluded from the backup, but hasn't been included in the default excludes list. As a workaround, add the following line to your {{backup-config.properties}}: {noformat} stash.home.excludes=**/.lock {noformat}
    via by Michael Heemskerk,
  • The origin of this post is the problem described in this [issue]([1]https://github.com/asciidoctor/asciid...). I am using the current Asciidoctor Gradle plugin to generate documentation. The plugin 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.0' works fine under Unix, but not under Windows. * Exception is: org.gradle.api.UncheckedIOException: java.io.IOException: The process cannot access the file because another process has locked a portion of the file at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:56) at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:34) at org.gradle.api.internal.changedetection.state.DefaultHasher.hash(DefaultHasher.java:24) at org.gradle.api.internal.changedetection.state.CachingHasher.hash(CachingHasher.java:45) at org.gradle.api.internal.changedetection.state.DefaultFileSnapshotter$1.run(DefaultFileSnapshotter.java:48) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:143) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:131) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134) at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:74) at org.gradle.api.internal.changedetection.state.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:44) at org.gradle.api.internal.changedetection.rules.InputFilesStateChangeRule.create(InputFilesStateChangeRule.java:33) at org.gradle.api.internal.changedetection.rules.TaskUpToDateState.(TaskUpToDateState.java:46) at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.getStates(DefaultTaskArtifactStateRepository.java:127) at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:69) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:283) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$1.run(DefaultTaskPlanExecutor.java:33) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:214) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:276) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142) at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:78) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:31) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:59) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45) at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:48) at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155) at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128) at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:220) at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:46) ... 85 more BUILD FAILED When I debugged the plugin it seams that the configuration phase is done right but the excecution phase doesn't start at all. When I checked out which file is locked I found out it is: {project dir}/.gradle/1.8/taskArtifacts/cache.properties.lock What can I do to provide more information and to isolate the problem to either Gradle or the Asciidoctor plugin? Kind regards, CL ---------------------------------------------------------------------------------------- [1] https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/51
    via by Gradle Forums,
    • java.io.IOException: The process cannot access the file because another process has locked a portion of the file at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:242) at com.cenqua.fisheye.io.IOHelper.copyStream(IOHelper.java:98) at com.cenqua.fisheye.io.IOHelper.copyStream(IOHelper.java:87) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:64) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:55) at com.atlassian.crucible.migration.item.FileSaver.add(FileSaver.java:55) at com.atlassian.crucible.migration.item.FileSaver.addPath(FileSaver.java:25) at com.atlassian.crucible.migration.item.FishEyeCacheBackup$SaverImpl.backup(FishEyeCacheBackup.java:104) at com.atlassian.crucible.migration.BackupManagerImpl.createBackup(BackupManagerImpl.java:260) at com.atlassian.crucible.migration.BackupManagerImpl.access$000(BackupManagerImpl.java:54) at com.atlassian.crucible.migration.BackupManagerImpl$2$1.perform(BackupManagerImpl.java:152) at com.atlassian.crucible.maintenance.MaintenanceManager.doMaintenance(MaintenanceManager.java:108) at com.atlassian.crucible.migration.BackupManagerImpl$2.run(BackupManagerImpl.java:150) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

    Users with the same issue

    richard77richard77
    5 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    18 more bugmates