[java] Why do I keep getting 'SVN: Working Copy XXXX locked; try performing 'cleanup'?

If you have worked with SVN tools in Eclipse (Subversion, subversive) before, then you are likely familiar with the 'working copy 'XXX' locked..." error.

I found a very useful post with a workaround for this problem at: Working copy XXX locked and cleanup failed in SVN

As great as the workaround is, it is a pain to do it over and over again. Does anyone know why I keep getting this error and what steps I could take to prevent it?

Context: I am creating an Eclipse plugin that involves listening for SVN events, so in testing this plugin, I am constantly opening and closing the workspace. I usually do 1 or 2 commits each time I open the workspace. Every so often the commit will fail and I get the 'working copy locked' error. I would love for this error to not happen anymore, so any advice is appreciated.

Thanks!

This question is related to java eclipse svn eclipse-plugin subclipse

The answer is


Solution: Step1: Have to remove “lock” file which present under “.svn” hidden file. Step2: In case if there is no “lock” file then you would see “we.db” you have to open this database and need to delete content alone from the following tables – lock – wc_lock Step3: Clean your project Step4: Try to commit now. Step5: Done.


After more exploration and testing, it appears that this issue was being caused by debugging the plugin and using breakpoints. SVN/Subclipse apparently didn't like having breakpoints midway through their execution and as a result this lock files were being created. As soon as I started just running the plugin, this issue disappeared.


I've had a lot of issues with SVN before and one thing that has definitely caused me problems is modifying files outside of Eclipse or manually deleting folders (which contains the .svn folders), that has probably given me the most trouble.

edit You should also be careful not to interrupt SVN operations, though sometimes a bug may occur and this could cause the .lock file to not be removed, and hence your error.


The following should unlock a locked working copy (tested on svn client version 1.6.11 and elipse version: Mars.2 Release (4.5.2))

step 1: (go to working copy directory) $cd working_copy_dir

step 2: (connect to svn sqlite database) $sqlite3 .svn/wc.db

step 3: (delete all records from table WC_LOCK) sqlite> delete from WC_LOCK;

step 4: (disconnect from sqlite 3 database) sqlite>ctrl + d

step 5: (from eclipse) right click on your working copy, then click Team -> Refresh/Cleanup


This happened to me when I copied a directory from another subversion project and tried to commit. The soluction was to delete the .svn director inside the directory I wanted to commit.


Generally a .lock file is created and it decides lock/unlock state checking the existince of this file. I think if you delete this .lock file only, then the problem will go away.


I had the same problem using the com.xxx.service.model package.

To fix it, I first made a backup of the code changes in the model package. Then deleted model package and synchronized with the repository. It will show incoming the entire folder/package. Then updated my code.

Finally, paste the old code commit to the SVN Repository. It works fine.


Make sure you exactly cleanup what the console says. For example if a subfolder (a package) is locked:

   svn: E155004: Commit failed (details follow):
  svn: E155004: Working copy 'C:\Users\laura\workspace\tparser\src\de\test\order' locked
  svn: E155004: 'C:\Users\laura\workspace\tparser\src\de\test\order' is already locked.

cleanup C:/Users/liparulol/workspace/tparser/src/de/mc/etn/parsers/order

Then you need to cleanup the specified folder and not the whole project. If you are in eclipse right click on the package, not on the project folder and execute the clean up.


This type of problem can happen when you delete/move files around - in essence making changes to your directory structure. Subversion only checks for changes made in files already added to subversion, not changes made to the directory structure. Instead of using your OS's copy etc commands rather use svn copy etc. Please see http://svnbook.red-bean.com/en/1.7/svn.tour.cycle.html

Further, upon committing changes svn first stores a "summary" of changes in a todo list. Upon performing the svn operations in this todo list it locks the file to prevent other changes while these svn actions are performed. If the svn action is interrupted midway, say by a crash, the file will remain locked until svn could complete the actions in the todo list. This can be "reactivated" by using the svn cleanup command. Please see http://svnbook.red-bean.com/en/1.7/svn.tour.cleanup.html


This will happen when something went wrong in one of your folders in you project. You need to find out the exact folder that locked and execute svn cleanup under the specific folder. You can solve this as follows:

  1. run svn commit command to find out which folder went wrong.
  2. change directory to that folder and run svn cleanup. Then it's done.

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to svn

Error "can't use subversion command line client : svn" when opening android project checked out from svn How to view changes made to files on a certain revision in Subversion Intellij idea subversion checkout error: `Cannot run program "svn"` How change default SVN username and password to commit changes? How to rename a file using svn? Connect Android Studio with SVN svn: E155004: ..(path of resource).. is already locked SVN Commit failed, access forbidden How to add an existing folder with files to SVN? Update OpenSSL on OS X with Homebrew

Examples related to eclipse-plugin

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved JavaScript Editor Plugin for Eclipse How to see my Eclipse version? No server in windows>preferences Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file ) An error occurred while collecting items to be installed (Access is denied) Maven in Eclipse: step by step installation How to save LogCat contents to file? How can I change Eclipse theme? What to do about Eclipse's "No repository found containing: ..." error messages?

Examples related to subclipse

Failed to load JavaHL Library How to fix Subversion lock error Why do I keep getting 'SVN: Working Copy XXXX locked; try performing 'cleanup'? Associating existing Eclipse project with existing SVN repository Subclipse svn:ignore How to change credentials for SVN repository in Eclipse? Adding a SVN repository in Eclipse Rolling back bad changes with svn in Eclipse