Solved

NSD Running (probably Memory Problem)

Posted on 2004-04-12
19
12,230 Views
Last Modified: 2013-12-18
Hi,
I have developed an Add-in for Lotus Notes 6.0
When i do an operation on notes, NSD runs and log is created.

I tried analyzing the log myself and also traced my whole code.I found that it fails on call to NSFItemIsPresent(...) API.

The problem is i dont get NSD error when i have 512 MB ram but it occurs everytime and at same place when i have 256 MB Ram on my machine...(thats my observation)...

Can any one help me with this problem as soon as possible.

I m wondering if its the problem with my Add-in or Notes doesnot find enough memory.(Actually i have checked for memory leaks but found none in my source code)

Also Can any one tell me , when does NSD run? (I have checked with my JIT debugger and its Not NSD so i assume that Notes itself starts NSD)
0
Comment
Question by:Santino_k
  • 10
  • 7
  • 2
19 Comments
 
LVL 24

Assisted Solution

by:HemanthaKumar
HemanthaKumar earned 40 total points
ID: 10813162
NSD is a diagnostic tool for debugging purpose. Whenever Notes crashes, NSD is invoked and a log file is generated for troubleshooting purpose.

In your case there was something related to memory handle error and it crashes when there is not sufficient memory to handle your add-in program.

What would be that ? I am not sure. Check your code and see if you are recycling the objects appropriately

~Hemanth
0
 
LVL 3

Author Comment

by:Santino_k
ID: 10821715
Hi Hemanth,

I have checked with my source code and didnt find any leak there... still i'll have a look once...

Can you tell me that if there is insufficient memory for notes to run... does NSD run?
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10823687
Sometimes this happens even with LS.. I don't blame your code.

While my LS Code works in one machine, it would fail on another machine which might have same configuration.. but incompatible drivers..

You have to check what are all the other process that is running during this crash.. try to minimize other apps and see how your code functions. There can be several reasons that could cause this problem..

Have u coded this in C++ or Java ??
0
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.

 
LVL 31

Accepted Solution

by:
qwaletee earned 60 total points
ID: 10825389
NSD is similar to Dr. Watson.  You can actually change the "system debugger" for Notes using Windows settings.

You might have a "hidden" memory leak.  Notes uses all sorts of buffer pools, and if you don't drop objects properly, Notes could run out of internal pool.  If you don't check all your API calls to make sure the objects were returned correctly, you might:

1) Attempt to open a Notes
2) API fails, but you don't catch it
3) You do an item check against a null note handle, or a note handle that points to an improperly loaded note

Since the default pool settings are partially dependent on memory size, that could account for the difference.

Also, I would try running it on another similar 256k machine.  It could just be that you need to reinstall Notes on that box.
0
 
LVL 3

Author Comment

by:Santino_k
ID: 10830227
Hi HemanthaKumar,

I have coded in C++. I'll take a look at it after minimizing other apps.


0
 
LVL 3

Author Comment

by:Santino_k
ID: 10830236
Hi qwaletee,

Even i was thinking about what u said  -- " Notes could run out of internal pool"

I'll check out ... hope it gets fixed soon
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11309004
Just wondering... did you ever get to the bottom of this?
0
 
LVL 3

Author Comment

by:Santino_k
ID: 11312938
Hi qwaletee,
No I am still struggling with it.
I had left it pending but from last few days I have again started working on it but I am not able to find the exact cause.
It fails at same point in my code when I call NSFItemIsPresent(...) API (I checked it in Notes header file and found its a macro. I used the underlying function NSFItemInfo(...) that it aliases to but still the problem persists).

Following is the brief Stack trace --
@[ 1] 0x6018eb23 nNOTES._Panic@4+483 (609d0016,213,0,12ef9c)
@[ 2] 0x60002576 nNOTES._LockHandle@12+294 (213,12ef98,12efa4,0)
@[ 3] 0x60009bd6 nNOTES._OSMemGetFaultHandle@4+22 (60bad0c6,7c6c10,0,213)
@[ 4] 0x60009c81 nNOTES._OSLockPool@8+17 (12efdc,213,7c6c10,0)
@[ 5] 0x6001062e nNOTES._NSFItemInfo@28+30 (213,7c6c10,12,0)
.....

I have a NSF hook installed wherein Notes calls a my Update function passing the NOTEHANDLE. I pass this note handle to NSFItemIsPresent(...) API.

Can you please help me in some direction what can be the problem?

Thanks.

Regards,
Santino
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11393413
Do you check the validity of the notehandle before you use it?
0
 
LVL 3

Author Comment

by:Santino_k
ID: 11395608
Hi qwaletee,
I was suspecting that I may be having an invalid notehandle.
qwaletee I have an event handler DLL that I have registered with Notes. Now when I get an event of a particular note being updated in this Event Hadnling DLL, I delegate this event to another Process using SendMessage API (I am using VC++).
To counter check I used the NSFItemIsPresent API in My Event Handling DLL and It worked but when for same NoteId I used NSFItemIsPresent API in my Request Processing Process it gave the above discussed NSD error.

Can you tell me how I can check validity of this Note Handle in my Request Processing Process???

Awaiting your reply.

Regards,
Santino

(If you want I can ask this as a seperate question but then I would want you to be the person answering it :-D )
0
 
LVL 3

Author Comment

by:Santino_k
ID: 11395894
Also I have a check in Request Processing Process for NoteHandle not being NULL. If it is NULL I display an error message. But I verified that the handle is not NULL when I process this handle in Request Processing Process.

In above Message I said
"To counter check I used the NSFItemIsPresent API in My Event Handling DLL and It worked but when for same NoteId I used NSFItemIsPresent API in my Request Processing Process it gave the above discussed NSD error."

Its actually NOTEHANDLE that I pass to NSFItemIsPresent and not NoteId.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11398857
Each process must initialize the Notes API separately, which could be your problem.  Also, I just don't know if a handle created under one API initialization would be valid in a second... might be OK, might not.

Why don't you dispatch the delegation to a separate thread within the same process, instead of into a separate thread?  Unless delegation is so that a separately-launched UI can handle it, there should be no need to do this.

If all else fails, you can simulate this, as long as you are using post-event notification, not pre-event notification.  You can extract the server/file/noteID from the notehandle in the event handler, and just pass this identifying data to the other process.  The only downsides:
1) Wateful to retrieve the note again if you already had it
2) Be careful not to cause an endless loop by modiying the note, or your event will get fired again.
3) As I said, only good for post-even handling, where the process is in the same level as the event handler was vis-a-vis preemptive access to the data.  In before event handling, the event handler has access to a note that has not yet been written to disk, and can lock access to the note and update it before it gets written.  What the delagted task would have is an already-written note that is available to other process already, and any further write to the note would count as a second update
0
 
LVL 3

Author Comment

by:Santino_k
ID: 11404418
Hi qwaletee,
Thank you very much for this detailed information.
I'll try what you have said and will let you know how things work out :-)

Thanks again.

Regards,
Santino
0
 
LVL 3

Author Comment

by:Santino_k
ID: 11423226
Hi qwaletee,
what I have implemented is NSF_HOOK and not Extension manager.
So dont know how to run that after note updation.
The even gets trapped in MyNoteUpdate(...) function whose pointer I set in DBHOOKVEC passed by Lotus Notes to my NSF_HOOK Dll's main entry point.
I tried using the server/file/noteID in my delegated task processor but got Notes hung after sometime. I logged the activity and found that I entered an endless loop.

Do you know how I can implement the NSF_HOOK so as to recieve notification after note gets updated or should I queue all requests in my delegated task process and then process them?

0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11427934
You are getting a loop because when your second process saves the note, it is triggering an additional hook call.  So, what you may want to do is have the second process set a dummy item on the document before it saves it.  The main hook can check if the dummy item is present.  if it is NOT present, it dispatches the event to the second process.  If the dummy item IS present, it removes the item (we don't want it to actually get saved!), lets the save proceed, and does NOT dispath an event.

If you queued the updates, you would run into teh same problem (and could use the same solution).

Note: as outlined above, this isn't very sophisticated, which means a system design could bypass your processing by adding the same dummy note item.
0
 
LVL 3

Author Comment

by:Santino_k
ID: 11477619
Hi qwaletee,
I tried things we discussed. But I think the whole problem is due to the existing design of my system.(I read somewhere that you should not use the notehandle in different threads also and here I am using it in seperate process.)
I cannot reopen the DB in which note exists because that triggers the NoteOpen Operation again so I cannot set some value in the document. But now I think I'll try with some other way but on similar line what you have told. Instead of setting value in some document I'll try setting some systems global value. With this I'll atleast check if things work then probably I can proceed without major changes to my design.
Will let you know about result once done.
BTW where are you from qwaletee and do you exclusively work on Lotus Notes?(answer only if I am  not getting personal)

Have a nice day
Regards,
Santino
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11483899
I'm in NYC, and most of what I do is Lotus Notes.
0
 
LVL 3

Author Comment

by:Santino_k
ID: 11491963
Hi qwaletee,

I am in India. Have just appeared for my final year of Masters in Computer Science. Am expecting my results by end of the month :-)

I tried synchronization of Note open and update. but things are not working. I am not able to open the database (ie:- Users mail file). Am working on it. will update you on what happens.

ciao,
Bye
have a nice day
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11493668
OK, thanks.  Sounds like a tricky thing to do, if you succeed, please post code (for both dispatch and consume).
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question