Domino/Notes version 11.0.1.
Core database does not have Allow document locking checked. It does have a script that makes a call to a "serial numbering" database that does have locking enabled. The script does a Notesdatabase.IsDocumentLockingEnabled check and calls a NotesDocument.Lock(True) both in the external serial numbering database.
Now if someone has a core database document open no one can open the document and we get the "Document is already locked by <username." error.
What am I missing? Thank you.
Hi Trey,
I tried to reproduce the issue as per case description provided by you.
I wrote code in "Querysave" event of one FORM present in some database where "Allow document locking" is unchecked.
I then take handle of another database from this code for which "Allow document locking" was checked.
At my end, I am not facing any challenges with respect to document present in database for which "Allow document locking" is unchecked.
Queries -->
1. How the code is being triggered at your end?
2. You able to reproduce the issue with another set of databases's. (by creating/using another DBs and executing same code?
Regards,
Amit
There has been few cases reported in past where similar error has been observed.
The Problem report number was "HSCI6CPCZV" with title as -->
"The document is already locked by someone else" while option "allow locking document" is NOT checked
Issue was observed while playing with same document from two different machines via Notes Client with different ID.
It doesnot looks to be a match with your case though.
Regards,
Amit
Thanks for the reply, Amit. More details:
In my form "Request" in the PostOpen event I call a function GenSeqNo() that is in a Script Library script named CounterScript. As in:
If source.IsNewDoc Then
' Generate new reqno from Counter DB method
newSeq = GenSeqNo( "testtrno" )
Here is part of the function GenSeqNo() contained in script CounterScript:
' db that holds counter docs
Set ctrdb = s.GetDatabase( strCounterServer, strCounterDB )
If ctrdb Is Nothing Then
Msgbox "Lock db doesn't exist"
End If
' exit if document locking is not enabled in db properties
If Not ctrdb.IsDocumentLockingEnabled Then
Msgbox "Document locking not enabled"
Exit Function
End If
Set v = ctrdb.GetView( "SeqNoView" ) ' get the view containing the counter doc
Set doc = v.GetDocumentByKey( docType, True ) ' locate counter doc for docType
Call doc.Lock( True )
nextNum = Clng( doc.strSeqNo(0) ) + 1 ' retrieve next number
doc.strSeqNo = Cstr( nextNum ) ' increment existing number in counter doc
Call doc.Save( True, False, False ) ' save should always return true - doc is locked by myself
Call doc.Unlock( )
GenSeqNo = Cstr( nextNum )</code></pre>
That is how I am serial numbering the document. I do not have any problems with this method per se. The issue is after the document (not the counteris saved and then opened by anyone, others who attempt to open the same document will get the Already Locked message.
In your example code I do not see any attempt to access an open document in the ss.CurrentDatabase which is where my problem occurs.
Thank you.
Hello
Since I do not know the design of that database, I don't know the exact cause.
It is possible that for some reason the item in the lock is still being added.
Try creating the following agent and running it against the target document.
Field $Writers := @DeleteFIeld;.
Field $WritersDate := @DeleteFIeld;
fter this, see if you can reproduce the problem.
Regards,
Shigemitsu Tanaka
Thank you, Shigemitsu.
Should these fields appear in the form's Properties/Fields list?
Hello @Trey Harris ,
The error message might be due to below reason also.
-> When you put the Document in edit mode, a "soft lock" is applied to the document regardless of the state of the document locking on the database. It's using that soft lock to notify the second user that the document is locked.
Please check if the script is putting target document in edit mode and resulting error message for other user.
Please refer below article if it may helpful to your scenario.
Title: Can a document be programmatically checked to see if it is soft-locked?
https://support.hcl-software.com/csm?id=kb_article&sysparm_article=KB0032767
Thanks & Regards,
Chaitanya Y
Thank you, Chaitanya.
Soft locking goes against everything I have experienced with Domino/Notes for the last 24 years, ha ha! What is the point of Replication errors if every document is soft locked when edited? :)
Some of our other databases that have been in production for 20 years began exhibiting the "Already locked" error only after I changed their serial numbering method to that described in my reply to Amit above.
Maybe my problem is because I have On Open set to Automatically open in Edit Mode? I'll try unchecking that.
Like I said before this issue has only arisen after changing to the new serial numbering method. Before that there was not a lock related code whatsoever in these databases.
Otherwise I am tempted to disable soft locks.
Hello Trey,
I verified the details of SPR#HSCI6CPCZV and understand that the issue observed in your environment is different from the cause of the issue reported in SPR.
I would suggest your to raise a case with HCL support team by providing respective DB and document for further assistance on this matter.
If the issue can be reproducible using the DB and respective document and specific set of steps to reproduce the issue, it would be very helpful to troubleshoot and come to conclusion about cause of issue.
Thanks & Regards,
Chaitanya Y