VS2005 with Vault caused file to be double checked out

This forum is now locked, since Gold Support is no longer offered.

Moderator: SourceGear

Locked
davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

VS2005 with Vault caused file to be double checked out

Post by davenovak » Wed May 16, 2007 5:06 pm

I am using Vault (3.5.2) integration with Visual Studio 2005 in a C# project. Through a rather unusual set of steps, I wound up with the same file checked out twice! As a result, I could not check in the changeset (as this produced errors – “cannot insert duplicate key . . .”). The only way I could fix the problem was to undo changes to one of the checkouts (after saving copy of the file). This actually undid both checkouts. I could then check out the file once again, apply the changes (which I saved to a temporary file), and check in the changeset successfully.

So how did this happen? Here are the steps (which you may, or may not, be able to reproduce):
  • 1. From Visual Studio, I started editing a C# file. This automatically checked out the file since I am using integrated SCC.
    2. After working on the file for several minutes, I saved changes (locally).
    3. I then mistakenly thought that I had made the changes to the wrong file. So I deleted my changes and did an Undo Checkout.
    4. Shortly thereafter, I realized that this indeed was the right file after all. So I hit Ctrl+Z several times to Undo my source deletions (to restore my changes). This triggered the file to be checked out again.
    5. I also made a number of minor changes to other files, which were checked out by Visual Studio 2005 and vault.
    6. During this whole time, I had the Vault client running in a separate window. Though I had not interacted with the client previously, I often use the client as my central location for checking in files. It was then that I noticed that the same file checked out twice. See picture below.
With any luck, you’ll be able to repeat these steps and figure out what went wrong.
Attachments
FileDoubleCheckedOut.JPG
File Double Checked Out
FileDoubleCheckedOut.JPG (34.45 KiB) Viewed 15364 times

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Thu May 17, 2007 12:39 pm

After a save locally it allowed you to perform a control-z to undo? I was following your instructions and couldn't do that part. I just made some changes then, but I didn't end up with the double check out.

Are you able to make this happen a second time at all?

davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

Post by davenovak » Thu May 17, 2007 12:54 pm

I don't have any problems reproducing this error. I just reproduced this problem again.
  • 1. Have Vault Client open.
    2. Open Visual Studio 2005 C# project (my VS2005 is patched with SP1).
    3. Start typing in a file. I added the following lines

    Code: Select all

            void TestMethod()
            {
            }
    
    
    4. Save file locally
    5. Select the method you just added and delete it.
    6. Diff file against Vault -- should be same as what's in Vault already
    7. Undo your checkout
    8. Now hit Ctrl+Z to undo delete operation from #5
    9. Add a comment inside your method so that your method looks like:

    Code: Select all

            void TestMethod()
            {
                // More changes!!!
            }
    
    
    10. Again save file locally.
    11. Go back to Vault client -- you'll see the double-check out (may need to hit F5)
Attachments
FileDoubleCheckedOutReproduced.JPG
Double checkout reproduced
FileDoubleCheckedOutReproduced.JPG (39.57 KiB) Viewed 15348 times

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Thu May 17, 2007 1:19 pm

Ok, I managed to get to where I could see double entries in Vault. I still only saw the one in Visual Studio. Also, I still can't do the undo part, but that didn't seem to be an integral part to make it happen.

Then I went to Visual Studio and just checked in the entire pending changes and it went in fine. Were you trying to do the check in with Vault or VS?

davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

Post by davenovak » Thu May 17, 2007 1:23 pm

I'm not sure why you can't do the Undo part -- I have several VS2005 machines and it works the same on all.

I do all of my checkins using Vault (almost never Visual Studio) so that I can check in as one "changeset".

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Thu May 17, 2007 2:45 pm

Do you ever view the pending changes in VS? That should check them in as a group as well I think.

Either way, I will go ahead and log a bug and have the developers look into this.

davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

How about TRIPLE check outs!?!

Post by davenovak » Wed Jul 04, 2007 1:18 pm

In this case, Visual Studio was doing all of the checking out. I never checked out this file myself. I did, however, undo checkout of this file twice from Visual Studio. Also, I had the client running the entire time in a seperate window. The picture speaks for itself as to the results.

Attempting to undo all the duplicate checkout results in the database error shown below. But undoing just the last one in the list seemed to work.

Is this problem any better in Vault 4.0? I'm still using Vault 3.5.2.
Attachments
DatabaseErrorUndoingMultiCheckouts.JPG
Database Error Undoing Multiple Checkouts
DatabaseErrorUndoingMultiCheckouts.JPG (18.95 KiB) Viewed 15034 times
FileTripleCheckedOut.JPG
File TRIPLE checked out
FileTripleCheckedOut.JPG (147.14 KiB) Viewed 15034 times

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Thu Jul 05, 2007 7:39 am

Could you zip up and send a server log that covers the time period of when you're doing this? You can either post it here or you can send that to support@sourcegear.com (attn: Beth), and please include a link to this forum thread.

davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

Post by davenovak » Thu Jul 05, 2007 7:47 am

Here you are, though there's not many clues in the log.
Attachments
sgvault.zip
(1.8 KiB) Downloaded 539 times

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Thu Jul 05, 2007 11:01 am

Actually, this was very useful. I will ask though that you place your server into debug mode so we can capture more information on this. That is done in the Admin tool under Server Options. You will need to perform an iisreset at a command line or run dialog after making the change. Then just post an updated log when it's captured again.

The error I saw was: Violation of PRIMARY KEY constraint. I will respond back with more soon.

davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

Post by davenovak » Thu Jul 05, 2007 11:26 am

So going back to my original question: has this issue been resolved in Vault 4.0? I thought a bug report was written up on it a few months ago.

The PRIMARY KEY violation is no surprise to me as the 3X undo checkout of the same file (and hence same primary key) would naturally produce such an error. But the real question (which the log give no hint to) is why did Vault allow that file to be checked out more than once? I'm somewhat inclined to think that the Vault Server did not allow it and that just the Vault Client is confused.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Thu Jul 05, 2007 1:20 pm

On the double check out portion, I have logged a bug. I'm concerned about seeing the primary key error and that's the portion I'm doing more digging on.

davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

Post by davenovak » Thu Jul 05, 2007 1:30 pm

I don't think there's any mystery as to what happened to caused that error -- it's exactly as I've stated in my previous post. The timing of this error in the log matches the time that I did the undo checkout of the 3 identical files.

And since you're still not answering my question, I'll ask it again: has this issue [double/triple checkout of same file] been resolved in Vault 4.0?
Last edited by davenovak on Thu Jul 05, 2007 1:49 pm, edited 1 time in total.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Post by Beth » Thu Jul 05, 2007 1:47 pm

No. This did not make the 4.0 release. The work for 4.0 was already set.

davenovak
Posts: 222
Joined: Mon Jan 15, 2007 2:15 pm
Location: Atlanta, GA

Post by davenovak » Thu Jul 05, 2007 1:52 pm

Fair enough -- that's all I needed to know.

Locked