• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1046
  • Last Modified:

Locking system : doc stays locked after user closed document

Hi,
I have designed a DB with locking system enabled. Some times the lock on a document stays even when the user closes the doc. Is it a bug?

Thanks in advance for your help,
Koray.
0
koray_uygun
Asked:
koray_uygun
  • 9
  • 9
  • 6
  • +1
2 Solutions
 
koray_uygunAuthor Commented:
How can I solve this? What should I do?
0
 
SysExpertCommented:
What version of Client and Server ?

Is the server very slow ?

Please provide more information, including the code you are using to lock and unlock the docuemnt.

I hope this helps !

0
 
koray_uygunAuthor Commented:
Client is 6.5.3, server is 6.5.5. The server is sometimes slow. I don't use any code to lock or unlock it.

Thanks for considering my problem.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
SysExpertCommented:
In the R 6.5 Designer type in
Lock into the help.

Here is what it says in the example

Example
Locks a document.
Note  This method is new with Release 6.5.
Defined in
Document
Syntax
public boolean lock()
    throws NotesException
public boolean lock(String name)
    throws NotesException
public boolean lock(String name, boolean provisionalok)
    throws NotesException
public boolean lock(java.util.Vector names)
    throws NotesException
public boolean lock(java.util.Vector names, boolean provisionalok)
    throws NotesException
Parameters
String name
java.util.Vector names
The names of the lock holders. Each lock holder must be a user or group. Defaults to one lock holder: the effective user. The empty string ("") is not permitted.
boolean provisionalok
true to permit the placement of a provisional lock
false (default) to not permit a provisional lock
Return value
boolean
true if the lock is placed
false if the lock is not placed
Usage
IsDocumentLockingEnabled in Database must be true or this method throws an exception.
This method:
places a persistent lock if the administration (master lock) server is available.
places a provisional lock if the administration server is not available and the second parameter is true.
throws an exception if the administration server is not available and the second parameter is false.
The following actions occur depending on the current lock status:
If the document is not locked, this method places the lock and returns true.
If the document is locked and the current user is one of the lock holders, this method returns true.
If the document is locked and the current user is not one of the lock holders, this method returns false.
If the document is modified by another user before the lock can be placed, this method throws an exception.
Language cross-reference
Lock method in LotusScript NotesDocument class
@DocLock function in formula language
Example
See Also
Locking documents and design elements

------------------

I hope this helps !
0
 
SysExpertCommented:
For Lotus script see
This view action attempts to lock the current document for all members of the "Guys" group. Locking is successful if the document is not yet locked, or the document is locked but the effective user is a member of Guys. A provisional lock is allowed if the administration server is not available.
%INCLUDE "lsxbeerr.lss"

Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
 
  REM Exit if locking is not enabled
  If Not db.IsDocumentLockingEnabled Then
    Print "Document locking not enabled"
    Exit Sub
  End If
 
  REM Get selected document
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
 
  REM Lock the document
  REM Not locked if return is False or error is raised
  On Error Goto errh
  If doc.Lock("Guys", True) Then
    Print "Document locked"
  Else
    Print "Document NOT locked"
  End If
  Exit Sub
errh:
  If Err() = lsERR_NOTES_LOCKED Then
    Print "Document NOT locked"
  Else
    Messagebox "Error " & Err() & ": " & Error(),, "Error"
  End If
  Exit Sub
End Sub
See Also
Lock method
0
 
koray_uygunAuthor Commented:
It is supposed to work without coding isn't it?
0
 
Sjef BosmanGroupware ConsultantCommented:
From the Designer Help database:

When you set the database property "Allow document locking," users with Author access or higher can lock documents in that database. Locking a document prevents editing and replication conflicts by ensuring that person who locks the document has exclusive rights to modify the document; others with the same rights cannot modify a locked document even if they are working on a different replica on the same LAN. Managers of a database cannot edit a locked document. However, managers can unlock documents that are locked.

So, no, it is not a bug. If you are Manager of the database, you can unlock the document.
0
 
marilyngCommented:
In a database where locking is enabled, then the document is automatically locked when it is saved.  The person who locked it is found in the $writers field, and the time it was locked is in the $writersDate field.

Select the document in the view, right click and from the right-click menu select "Unlock the document"  If you have correct access, or are the person listed in the $Writers field, you can unlock the document, and both the $writers field and $WritersDate fields will be deleted from the document.

If you select "lock the document" when it is already locked, you will get a message, "The document is already locked."

Obviously, the author rules come into play here.  The person who locks the document has "last edit rights" and only he or she can lift the lock, unless, as sjef says, you are the database manager.
0
 
koray_uygunAuthor Commented:
Hi all,
Sjef, I have understood what you said but as I said at the beginning, the closed documents are locked. What I understood of this feature is that a doc is locked when edited then automatically unlocked when closed.
Marilynq, the document is locked when saved or when edited? Does it stay locked even when it is closed? Do we have to unlock it by code?

Thanks to you all.
0
 
Sjef BosmanGroupware ConsultantCommented:
As Marylin says,
>  the document is automatically locked when it is saved
so the user who locked it (automatuically) should unlock the document.

From the Help database:
"To unlock a document you have locked, you must use the same User ID you used when you locked the document.
  1.    Select the document you want to unlock.
  2.    Do one of the following:
Choose Actions - Unlock Document to manually unlock a document
Close the document if you opened or placed it in Edit mode to set a temporary lock.
Tip  The status bar says "Document successfully unlocked" when you unlock a document."

Locking can be programmed in the Save-button if you have one. See the @DocLock function.

@DocLock ( [ options ] )
[LOCK] Locks the current document.
[UNLOCK] Unlocks the current document.
[STATUS] Indicates the locked status of the current document. Returns null if the document is not locked or a textlist of the users who have locked the document if it is locked.
[LOCKINGENABLED] Indicates if the current database has document locking enabled. Returns 1 (@True) if locking is enabled and 0 if it is not.
0
 
koray_uygunAuthor Commented:
What is a temporary lock? May be it is the one I use. If I had to unlock the each doc (by code at queryclose), all the docs should have been locked. But I have only some documents locked.
0
 
Sjef BosmanGroupware ConsultantCommented:
The more I read the Help, the more I doubt the statement "the document is automatically locked when it is saved".

It seems to me that document locking is primarily a user action if you didn't use any locking in your application. The user who locked the document is in the $Writers-field of the document. Ask that person what (s)he did on $WritersDate.
0
 
koray_uygunAuthor Commented:
Ok, I have just made a test. As I taught, when I edit a doc, the $Writers and $WritersDate fields are filled with my name and the present date. Then, when I close the doc, these fields are removed. All of this without code. This is the normal behaviour for me but my original question is that this automatic unlocking when closing an edited doc sometimes does not work properly and the doc remains locked.
0
 
marilyngCommented:
sjef.. I tested my statement before I posted.  Several times because I didn't believe it the first time.  The document locked itself automatically when I saved it.  Maybe it was my setup or my quick test scenario, but when i went to manually lock it, I got the "Document is already locked.." No one was more surprised than me.
0
 
marilyngCommented:
The difference might be in the administration server value in the ACL of the database and if this replica is sitting on the administration server.   I tested on the Administration server, with the Administration server set in the ACL.  If the ACL is not set, then the document might not automatically lock.   If the replica is not sitting on the administration server, it depends on replication to lock it.  I think.....?
0
 
Sjef BosmanGroupware ConsultantCommented:
I just tested the following:
- existing doc, open for Edit, check properties in view: Locked; saved, closed -> Not locked
- new doc, saved, closed -> Not locked!

ACL not set? Then you can't enable document locking in the database.

Tested on R7.0.1 by the way...

0
 
marilyngCommented:
Well, I'm still on 6.5.3 - I wasn't expecting it to be locked, either.  In 6.5.3 you can enable, but you get the message that the ACL needs to have an administration server.   Very odd..

Yeah, Yeah, rub it in that you're on 7.0.1
0
 
Sjef BosmanGroupware ConsultantCommented:
Nod odd. The message in the ACL is the same. You THINK you enabled it, a tick is displayed, but I noticed that when you open the properties again, it isn't enabled at all. So without an Admin server, no locking.
0
 
koray_uygunAuthor Commented:
The lock admin server in the ACL is manager so the problem isn't there...
0
 
Sjef BosmanGroupware ConsultantCommented:
Did you check some of the locked documents? And ask the users what they or how they did it did?
0
 
koray_uygunAuthor Commented:
I will as soon as I see a locked doc, unfortunately I had to unlock the docs manually to solve the pb.
0
 
marilyngCommented:
Perhaps add a view that collects on @isAvailable($Writers) and x days old, and then use an automated agent to unlock them.  I would probably do this, anyway.  Whenever I had to lock documents the old way, I had a view and an agent that would unlock them after they were a day old.
0
 
Sjef BosmanGroupware ConsultantCommented:
Ah, what a pity... But if you say that a doc stays locked after closing the document, you should be able to reproduce a locked document easily. True??

There are no calls to @DocLock or NotesDocument.Lock in your application?
0
 
marilyngCommented:
I think koray said there was no coding other than configuring locking on the server and using it manually.
0
 
Sjef BosmanGroupware ConsultantCommented:
I know, I know, just checking... Being careful...
0
 
koray_uygunAuthor Commented:
Yes, marilynq, there is no code...
0
 
Sjef BosmanGroupware ConsultantCommented:
I suppose that, when Notes crashes while a document is locked, the document stays locked. I hope you don't have that many crashes...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 9
  • 6
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now