- - - By CrazyStat - - -

13. March 2013

TortoiseSVN: after stopping merge, workspace is “locked”

Filed under: Windows — Tags: , , , , , , , , — Christopher Kramer @ 20:43

TortoiseSVN is a great Windows Application to access (and even create) SVN repositories. It integrates perfectly into Windows Explorer and has very good merge and diff tools. In my opinion it’s simply the best Windows SVN client available. If you don’t use it already, you should give it a try.

Problem: Working Copy locked after Merge failed

When I tried to apply a patch using TortoiseSVN, I noticed I wanted to apply another patch instead and therefore closed the merge program before it was started completely.

After this, I was not able to apply the other patch. TortoiseMerge said the workspace was locked:

TortoiseMerge: Workspace locked

TortoiseMerge: “Workspace copy is already locked”

It was also not possible to update the workspace:

Update: Workspace locked

Update: Working Copy is locked

So I tried to unlock it, which is not possible:

TortoiseSVN: "Nothing locked"

TortoiseSVN: “There is nothing¬† to unlock”

So this is pretty strange. Here is how to solve it:

Solution: Clean up working copy status

Right-click on the directory and choose “TortoiseSVN”/”Clean Up”.

TortoiseSVN: Clean up

TortoiseSVN: Clean up

Then only choose “Clean up working copy status”:

TortoiseSVN.:Clean up working copy status

TortoiseSVN.:Clean up working copy status

Click “OK” and that’s it. You can now again update or apply patches without any problems.

I hope this helps somebody to solve his problem a little faster.


Try my Open Source PHP visitor analytics script CrazyStat.

4. October 2012

PDO / sqlite: database table is locked

Filed under: DBMS,PHP,phpLiteAdmin — Tags: , , , , , , , — Christopher Kramer @ 22:06

At the moment I am working again on phpliteadmin, a  php-based web GUI for database administration of sqlite databases. While debugging, I stumbled across a problem that only occurred with the PDO extension (not with SQLiteDatabase or SQLite3). I got the following error message while trying to drop a table:

HY000 / 6 / database table is locked

By the way, you can use PDO::errorInfo() to get these error messages. So as the error correctly explains, the table I tried to drop seemed to be in use. PDO documentation for PDO::query() also explains the problem (even though DROP TABLE statements are fired using PDO::exec()):

If you do not fetch all of the data in a result set before issuing your next call to PDO::query(), your call may fail. Call PDOStatement::closeCursor() to release the database resources associated with the PDOStatement object before issuing your next call to PDO::query().

So I hunted for the open cursor on a resultset of the table in question and could not find any. Finally, I found the SQL statement which still had an open cursor:

SELECT * FROM sqlite_master

Thinking about this, it is obvious: When querying sqlite_master, you request information about database tables. If one of the table gets altered or dropped, this might change the data listed in the resultset on which I still have a cursor.

Maybe this is a special case as usually you do not query sqlite_master a lot. But in case you do, this might be useful information.

To solve the problem, as the manual says, simply release the cursor using PDOStatement::closeCursor() before dropping/altering tables.