Why do I keep getting 'SVN: Working Copy XXXX locked; try performing 'cleanup'?
Asked Answered
T

11

45

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!

Trabue answered 1/2, 2011 at 17:35 Comment(1)
Have you been able to fix this without doing the Team -> Cleanup? I do not want my users to have to keep doing a refresh/clean up...Osteophyte
I
80
  1. Select the project
  2. Right click on the selected Project
  3. Team -> Cleanup

Problem Solved.

Note: The Above steps will work only Eclipse(Indigo package)

Inveterate answered 1/7, 2013 at 6:0 Comment(6)
It works on Eclipse Luna too... Thanks for the hint.Shanghai
Worked for Luna Service Release 1 (4.4.1)Gink
It works on Android Studio 1.2.1. Thank you so much.Airedale
Works in MyEclipse 8.6.1 too!Brooder
works in my RAD (Rational Application Developer) tooDeficiency
Very often - it does NOT help. I got the lock message every time I tried to do cleanup in Eclipse. What worked for me was to issue "svn cleanup" command in svn client command tools (I used TortoiseSVN).Zenaidazenana
G
14

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.

Garderobe answered 1/2, 2011 at 17:53 Comment(11)
i'm not at my computer to test it.. but doesn't svn cleanup fix that as well? I know I usually just delete the .lock file :pPrejudicial
Why does it get locked though? I never asked for it to be locked and I don't think my interactions with Eclipse or subversion warrant it being locked. Also, under the team options, there are lock and unlock options. During this error, the Lock option is enabled, and the Unlock option is disabled.Trabue
SVN cleanup fails too. That doesn't seem to be a way to solve this issue.Trabue
@Treebranch It is probably locking because of one of the reasons I mentioned above. Also @Daniel makes a good pointPrejudicial
@KennyCason it should, if it works. @Treebranch I think when it starts the commit, it creates this file and then removes it when the commit is completed. There may be other cases as well to create this file. however, it normally should not be staying forever. I guess sometimes, bugs, it fails to delete the lock file and then it assumes there is an ongoing operation which will affect the stability of the source and does not allow any change. However, normally there is a reason for that file to be there. :)Garderobe
@KennyCason I haven't been modifying files outside of Eclipse. And when I do 'cleanup' through Eclipse it says 'An internal error has occurred during: SVN Cleanup'. I am still going to try doing SVN cleanup on the command line though.Trabue
@Treebranch, in that case it is likely because of an interruption/bug during a SVN operation like @faith and other posters said :)Prejudicial
well, the other poster deleted his answer apparentlyPrejudicial
Yeah, I tried doing 'svn cleanup' on the command line as well and this doesn't seem to have any effect either.Trabue
@KennyCason I am more looking for a permanent solution. The link I posted has plenty of hacks/workarounds, but I was hoping to find something more permanent.Trabue
In that case I would say just be careful, and follow the advice given. Ultimately, if it occurs because of SVN crashing or some other bug, there is little you can do about it.Prejudicial
P
9

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.

Prejudicial answered 1/2, 2011 at 17:40 Comment(1)
You make a good point, I believe the reason I was getting the errors is because I was debugging my plugin and the breakpoints were interrupting the SVN commands.Trabue
H
4

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.

Hustings answered 19/11, 2014 at 8:31 Comment(1)
this is the true solution, lifesaver.Oreste
T
3

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.

Trabue answered 28/2, 2011 at 18:40 Comment(0)
S
3

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.
Schlosser answered 7/4, 2016 at 9:19 Comment(0)
C
3

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

Capias answered 21/3, 2017 at 19:44 Comment(0)
I
2

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.

Infundibulum answered 27/8, 2011 at 13:7 Comment(0)
P
1

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.

Pretzel answered 2/12, 2011 at 16:59 Comment(0)
P
0

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

Pallas answered 13/1, 2014 at 7:27 Comment(0)
O
0

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.

Oldtime answered 4/1, 2017 at 14:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.