Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Another bug in new locking code in 1.1.9

subclipse
Discussion topic

Back to topic list

Another bug in new locking code in 1.1.9

Author thofmann
Full name Thomas Hofmann
Date 2006-12-23 02:53:08 PST
Message Hi Mark,

On Thursday I introduced some of my teammates to using Subversion with Subclipse. We use locking for UML model files together with RSA 7.

The models are locked to prevent concurrent modifications which is not a so good thing to have with model files.

Anyway, as it turned out locking did not work as it worked before.

The problem is as follows:

When a lock request is made on a file (read-only in the workspace) that is already locked by another user the file will be read write after the lock command has run. The message about the other user having the lock appears in the console but the read only flag is always removed.

It took me some time to find out how this all works because I wanted to be able to debug down to the svnkit. I know have everything setup for debugging and can explain the problem.

The bug is in the new code of LockResourcesCommand:

        try {
            monitor.beginTask(null, 100);
            OperationManager.get​Instance().beginOper​ation(svnClient);

            svnClient.lock(resou​rceFiles,message,for​ce);
            // Ensure resource is writable. SVN will only change read-only
            // flag if the svn:needs-lock property is set.
            for (int i = 0; i < resources.length; i++) {
                makeWritable(resources[i]);
            }
        } catch (SVNClientException e) {
            throw SVNException.wrapException(e);
        } finally {
            OperationManager.get​Instance().endOperat​ion();
            monitor.done();
        }

The comment explains the intention of the code. I guess that an exception being thrown in case the locking fails was expected by the author of the new code. Unfortunately, this is not the case if the lock operation completes but returns with the information that some other user has the lock. In this case a handler set on the SVNClientImpl (when using SVNKit) is called with the information about the other user having the lock. This information is printed to the console using the JhlNotificationHandler and NotificationListener.

The code inside the LockResourceCommand will continue to execute and thus all files will be made read write.

So the fix would probly be something like this:

- Register a new handler before svnClient.lock(resou​rceFiles,message,for​ce) is called and only call the makeWritable in case the handler signals success.


Thinking about this some more I really don`t see why it is necessary to make the files read write that were read only before and do not have the needs-lock property.
I could imagine someone using the lock operation explicitly on a resource that does not have the needs-lock but this would not make much sense for me because the other users won√Ąt be prevented from making changes becaus there copies are not read-only in their workspaces.

I think definitly needs to be fixed for 1.1.10 since it maes using locks unsafe. In case the lock dialog is triggered implicitly when a user just begins to modify it and then saves it the modifications will be persistet altough the console shows the error message about the resource being locked.

One thing that I would also like to mention is that I would expect an error dialog in case the resource is already locked by someone else. It is difficult to understand for new users that they need to look at the SVN console to see why something is not working.

What do you think?

Regards,

Thomas

« Previous message in topic | 1 of 15 | Next message in topic »

Messages

Show all messages in topic

Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2006-12-23 02:53:08 PST
     Re: [Subclipse-dev] Another bug in new locking code in 1.1.9 Mark Phippard <markphip at gmail dot com> Mark Phippard <markphip at gmail dot com> 2006-12-23 05:38:37 PST
         Re: [Subclipse-dev] Another bug in new locking code in 1.1.9 Mark Phippard <markphip at gmail dot com> Mark Phippard <markphip at gmail dot com> 2006-12-24 06:35:08 PST
             RE: [Subclipse-dev] Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2007-01-05 00:37:26 PST
                 Re: [Subclipse-dev] Another bug in new locking code in 1.1.9 Mark Phippard <markphip at gmail dot com> Mark Phippard <markphip at gmail dot com> 2007-01-05 03:20:25 PST
                     RE: [Subclipse-dev] Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2007-01-05 03:34:24 PST
                         RE: [Subclipse-dev] Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2007-01-05 14:32:57 PST
                             RE: [Subclipse-dev] Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2007-01-10 13:22:30 PST
                                 Re: [Subclipse-dev] Another bug in new locking code in 1.1.9 Mark Phippard <markphip at gmail dot com> Mark Phippard <markphip at gmail dot com> 2007-01-10 13:35:58 PST
                                     RE: [Subclipse-dev] Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2007-01-10 13:32:51 PST
                                     Re: [Subclipse-dev] Another bug in new locking code in 1.1.9 Alexander Kitaev <Alexander dot Kitaev at svnkit dot com> Alexander Kitaev <Alexander dot Kitaev at svnkit dot com> 2007-01-10 15:08:59 PST
                                         RE: [Subclipse-dev] Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2007-01-10 21:07:01 PST
                                             Re: [Subclipse-dev] Another bug in new locking code in 1.1.9 Alexander Kitaev <Alexander dot Kitaev at svnkit dot com> Alexander Kitaev <Alexander dot Kitaev at svnkit dot com> 2007-01-12 07:14:26 PST
                                                 RE: [Subclipse-dev] Another bug in new locking code in 1.1.9 thofmann Thomas Hofmann 2007-01-12 11:23:49 PST
                                                     Re: [Subclipse-dev] Another bug in new locking code in 1.1.9 Mark Phippard <markphip at gmail dot com> Mark Phippard <markphip at gmail dot com> 2007-01-12 11:46:09 PST
Messages per page: