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

112,485

Solution 1

  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)

Solution 2

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.

Solution 3

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.

Solution 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.

Solution 5

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

Share:
112,485

Related videos on Youtube

jbranchaud
Author by

jbranchaud

I love writing code, photographing things, and shooting pool. I created captionss - Sensible CSS Image Captions I am a co-founder of Beer and Code in Lincoln, NE. I am on GitHub and Flickr. Feel free to contact me via email or twitter.

Updated on March 22, 2020

Comments

  • jbranchaud
    jbranchaud about 4 years

    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!

    • Chris Bolton
      Chris Bolton about 9 years
      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...
  • Kenny Cason
    Kenny Cason over 13 years
    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 :p
  • jbranchaud
    jbranchaud over 13 years
    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.
  • jbranchaud
    jbranchaud over 13 years
    SVN cleanup fails too. That doesn't seem to be a way to solve this issue.
  • Kenny Cason
    Kenny Cason over 13 years
    @Treebranch It is probably locking because of one of the reasons I mentioned above. Also @Daniel makes a good point
  • fmucar
    fmucar over 13 years
    @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. :)
  • jbranchaud
    jbranchaud over 13 years
    @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.
  • Kenny Cason
    Kenny Cason over 13 years
    @Treebranch, in that case it is likely because of an interruption/bug during a SVN operation like @faith and other posters said :)
  • Kenny Cason
    Kenny Cason over 13 years
    well, the other poster deleted his answer apparently
  • jbranchaud
    jbranchaud over 13 years
    Yeah, I tried doing 'svn cleanup' on the command line as well and this doesn't seem to have any effect either.
  • jbranchaud
    jbranchaud over 13 years
    @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.
  • Kenny Cason
    Kenny Cason over 13 years
    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.
  • jbranchaud
    jbranchaud over 12 years
    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.
  • rickygrimes
    rickygrimes over 10 years
    Thanks. Cleanup definitely helped.
  • CanC
    CanC over 9 years
    It works on Eclipse Luna too... Thanks for the hint.
  • Murat Yıldız
    Murat Yıldız about 9 years
    Worked for Luna Service Release 1 (4.4.1)
  • Alberto
    Alberto almost 9 years
    It works on Android Studio 1.2.1. Thank you so much.
  • techie2k
    techie2k over 8 years
    Works in MyEclipse 8.6.1 too!
  • andreasperelli
    andreasperelli over 8 years
    this is the true solution, lifesaver.
  • NOT_A_PROGRAMMER
    NOT_A_PROGRAMMER over 7 years
    works in my RAD (Rational Application Developer) too
  • Dominik Myszkowski
    Dominik Myszkowski over 5 years
    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).