Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows NT RPC Service / Name Service Database

Posted on 1999-07-19
7
Medium Priority
?
413 Views
Last Modified: 2008-03-04
I have a windows nt service that uses rpc.  I have been having some problems with being able to reliably obtain a binding between client and server.

When the server is installed it does the following:

SetupProtocols();
RegisterInterface();
InquireBindings();
// Clear the endpoints out of the binding handles
// This forces the clients through the endpoint mapper and
// reduces the volatility of the namespace entry for this service.

for(UINT i = 0; i < m_pBindingVector->Count; ++i)
{
      RpcBindingReset(m_pBindingVector->BindingH[i]);
}

InitialiseSecurity();
ExportToNS();

According to msdn I should not keep exporting to NS each time I run...I know this info. seems to contradict all the examples they provide!...

So when I Start the service:

SetupProtocols();
RegisterInterface();
InquireBindings();                  
RegisterEndpoint();                         InitialiseSecurity();
Listen();

When I stop:

UnregisterEndpoint();
FreeBindings();
UnregisterServer();

This code means that I don't get stale entries in the NS as I used to when I followed earlier examples which used to export each time the service started...but I still find I have problems getting bindings sometimes, and the resolution is to uninstall and then reinstall the service, presumably reinstalling the ns entry for the service...but how does the ns entry get lost?  What is the best way to check on startup?
0
Comment
Question by:Blondie050798
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
PinTail earned 1000 total points
ID: 1200502
Unfortunately you have fallen victim to a known problem with Microsoft RPC, they have a hotfix available, although I have searched the site and can't find it.

The reason I know about this is that I raised this issue as a bug to them over a year ago, and provided an application that proved that the problem was in their locator service, not in my code.  They finally admitted they had a problem, it then took about six months to get it corrected.

If you don't have any luck finding the HotFix get back to me and I can give you the name of the Microsoft Techie that actually shipped me the fix.
0
 
LVL 1

Author Comment

by:Blondie050798
ID: 1200503
What exactly was the bug that you raised? Entries in the NS disappear?  Did you cater for this in your code, or did the fix they supplied simply cure it?
Does SP5 have this fix included? I notice that it seems to contain a lot of RPC related patches...?

TIA
Paul.

0
 
LVL 3

Expert Comment

by:PinTail
ID: 1200504
>>What exactly was the bug that you raised?
missing or ghost entries in RPCNSLookupXXX or RPCNSBindingImportXXX

>>Entries in the NS disappear?  
Yes, I refere to these as missing. As apposed to what I call ghost entries, which are entries that the locator DB is maintaining, even though I have cleanly shut down (and de-registered) my service.

>>Did you cater for this in your code, or did the fix they supplied simply cure it?

I actally ended up writting a custom Locator Database system, because I couldn't wait for MS to fix their stuff, but they did finally provide a fix, and it seems to work.

>>Does SP5 have this fix included? I notice that it seems to contain a lot of RPC related patches...?

I think it might, I got it as a HotFix ( just locator.exe )



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.

 
LVL 1

Author Comment

by:Blondie050798
ID: 1200505
Can you send me the details you got from Microsoft, i.e. the techie...

When I raise bugs they never seem to respond, so I've given up telling them... :-(

So am I carrying out the proper actions in install, start, and stop?  I also have an uninstall which I'm unsure about.  I remove the name service entry and then all the registered endpoints:

RpcNsMgmtBindingUnexport(RPC_C_NS_SYNTAX_DEFAULT, (UCHAR*)lpszEntry, &id, RPC_C_VERS_ALL, NULL);

RPC_EP_INQ_HANDLE hInquiryContext = NULL;

iStatus = RpcMgmtEpEltInqBegin(NULL, RPC_C_EP_MATCH_BY_IF, &id, RPC_C_VERS_ALL, NULL, &hInquiryContext);
       
if(iStatus == RPC_S_OK)
{
      bool bContinue = true;

      while(bContinue)
      {
            RPC_BINDING_HANDLE hBinding = NULL;
            iStatus =  RpcMgmtEpEltInqNext(hInquiryContext, &id, &hBinding, NULL, NULL);

            if(iStatus == RPC_X_NO_MORE_ENTRIES)                        bContinue = false;            
            else                  
                  iStatus =  RpcMgmtEpUnregister(NULL, &id, hBinding,      NULL);                   

            if(hBinding)
                  RpcBindingFree(&hBinding);
      }

      iStatus = RpcMgmtEpEltInqDone(&hInquiryContext);  
}       

Am I carrying out all these actions correctly?

Sorry to keep dragging this question out, but It's nice to have found someone that knows about RPC...seems to be a black art...

0
 
LVL 3

Expert Comment

by:PinTail
ID: 1200506
It looks right to me.  In fact The End Point Manager is supposed to periodically validate his DB, so even if your application fails to unregister correctly ( for example in the case of a crash ), given enough time, the EPManager is supposed to know about this and delete the entry in it's EPDB.  I have never found adequate documentation which discusses things like the periodicity of the EPMngr DB flush, or how to programmatically determine the host machine for the EPMngr ( this would help because you could stop and start his locator, and this would cause his DB to be cleaned  - at least that's what I can surmise).

I can e-mail the source code to a noddy little application I sent to MS.  It basically just illustrates that there are ghost and missing entries in the EndPoint Mapper DB, no matter what you do to try to prevent it ( as far as correct shutdown, etc ).  It's a bit big for posting here.
0
 
LVL 1

Author Comment

by:Blondie050798
ID: 1200507
Great...anything you can send as regards this matter would be really useful!...

As long as I can get some kind of proof together that it is not my code but an MS bug...

EMail: Paul.Reynolds@cmgroup.co.uk
0
 
LVL 1

Author Comment

by:Blondie050798
ID: 1200508
I've just had a bit of a search on the MS site, and found Article ID Q235863 dated July 1 1999...

RPC Locator Returns Duplicate or Missing Entries to RpcNsBindingLookup Calls...

This appears to be the problem that you mentioned, although it states that 'if you use these function sets in a mixed Windows NT version 3.51 and 4.0 domain, you may observe duplicate or missing binding handles being returned by the call'....my environment is totally NT4...so this article appears to be saying the fault does not apply to my situation...?!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

715 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