Menu

#103 Identical service should not be registered again and again.

v2.1
open
5
2017-04-07
2008-07-28
Anonymous
No

This happened in one of our applications based on openslp.
To make the service persistent, the app who's exposing the service will register a service with identical name periodically.

And after we left it there running for some day, we got errors like this and cannot find the service any longer.

C:\Program Files\ibm\dsagent\bin>slptool unicastfindsrvs $IPADDRESS wbem
errorcode: -23

Later we found there are a bunch of listening socket got created on 427 socket, we tried to poke around the code, and think the possible reason for this is:

Each time service is registered slpd will set up listener for the service request datagram, they are all using port 427, when doing this slpd doesn't try figure out if it's already in
the multicast group for the listening. And the opened socket number will be more and more until reach the limit.

There is another problem in code when removing service. In the original code when removing services all the scope attribute is filled with site_local,two of them should be node_local and link_local. Because of this each time when service expired, only the socket for site_local got destroyed and left the other two as garbage.

From int SLPDIncomingRemoveService(const char * srvtype, size_t len) .
{

......

while (sock_next)
{
sock = sock_next;
sock_next = (SLPDSocket *) sock->listitem.next;

res = SLPNetGetSrvMcastAddr(srvtype, len, SLP_SCOPE_SITE_LOCAL, <---
&srvaddr_node);
if (res != 0)
return -1;
res = SLPNetGetSrvMcastAddr(srvtype, len, SLP_SCOPE_SITE_LOCAL, <---
&srvaddr_link);
if (res != 0)
return -1;
res = SLPNetGetSrvMcastAddr(srvtype, len, SLP_SCOPE_SITE_LOCAL, <---
&srvaddr_site);
if (res != 0)
return -1;

if (sock && (SLPDSocketIsMcastOn(sock, &srvaddr_node)
|| SLPDSocketIsMcastOn(sock,
&srvaddr_link)
|| SLPDSocketIsMcastOn(sock,
&srvaddr_site)))
{
SLPDSocketFree((SLPDSocket *)
SLPListUnlink(&G_IncomingSocketList, (SLPListItem *) sock));
sock = NULL;
}
}

......
}

Discussion

  • John Calcote

    John Calcote - 2017-04-07

    is it possible your subsequent registrations are all setting the 'fresh' flag to true?

     
  • John Calcote

    John Calcote - 2017-04-07
    • assigned_to: John Calcote
    • Group: --> v2.1
     

Log in to post a comment.