Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-657

Devices get lost after a certain period of time (SSDP sockets do not get closed properly in cyberlink lib)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • upnp-basedriver-0.8.0
    • upnp-basedriver-0.8.0
    • UPnP Subproject
    • None

    Description

      Under Linux Systems every Socket uses a "file descriptor" in the system
      which is in most unix systems default value of 1024 max descriptors.
      Now i tried to push that value to 65535 and vuala everything is running > 8
      hours.

      If i check my open file descriptors with lsof -p pidofmyjavaprogram i see
      now MANY open ports that have not been closed properly (right now > 1400 for
      10 hours of operation).

      Ok..that made me let a bit deeper into the code of cyberlink library.

      I saw a fix that was introduced by someone because of "non-closed" ssdp udp
      sockets in the announce method of org/cybergarage/upnp/Device.java

      1240 SSDPNotifySocket ssdpSock = new SSDPNotifySocket(bindAddr);
      1241
      1242 SSDPNotifyRequest ssdpReq = new SSDPNotifyRequest();
      1243 ssdpReq.setServer(UPnP.getServerName());
      1244 ssdpReq.setLeaseTime(getLeaseTime());
      1245 ssdpReq.setLocation(devLocation);
      1246 ssdpReq.setNTS(NTS.ALIVE);
      1247
      1248 // uuid:device-UUID(::upnp:rootdevice)*
      1249 if (isRootDevice() == true)

      { 1250 String devNT = getNotifyDeviceNT(); 1251 String devUSN = getNotifyDeviceUSN(); 1252 ssdpReq.setNT(devNT); 1253 ssdpReq.setUSN(devUSN); 1254 ssdpSock.post(ssdpReq); 1255 1256 String devUDN = getUDN(); 1257 ssdpReq.setNT(devUDN); 1258 ssdpReq.setUSN(devUDN); 1259 ssdpSock.post(ssdpReq); 1260 }

      1261
      1262 //
      uuid:device-UUID::urn:schemas-upnp-org:device:deviceType:v
      1263 String devNT = getNotifyDeviceTypeNT();
      1264 String devUSN = getNotifyDeviceTypeUSN();
      1265 ssdpReq.setNT(devNT);
      1266 ssdpReq.setUSN(devUSN);
      1267 ssdpSock.post(ssdpReq);
      1268
      1269 // Thanks for Mikael Hakman (04/25/05)
      1270 ssdpSock.close();

      Ok seems fine so far...

      Ok now i looked into org/cybergarage/upnp/Service.java and there the "socket
      close fix" was NOT introduced for both announce and byebye.....

      599 public void announce(String bindAddr)
      600

      { 601 // uuid:device-UUID::urn:schemas-upnp-org:service:serviceType:v 602 Device rootDev = getRootDevice(); 603 String devLocation = rootDev.getLocationURL(bindAddr); 604 String serviceNT = getNotifyServiceTypeNT(); 605 String serviceUSN = getNotifyServiceTypeUSN(); 606 607 Device dev = getDevice(); 608 609 SSDPNotifyRequest ssdpReq = new SSDPNotifyRequest(); 610 ssdpReq.setServer(UPnP.getServerName()); 611 ssdpReq.setLeaseTime(dev.getLeaseTime()); 612 ssdpReq.setLocation(devLocation); 613 ssdpReq.setNTS(NTS.ALIVE); 614 ssdpReq.setNT(serviceNT); 615 ssdpReq.setUSN(serviceUSN); 616 617 SSDPNotifySocket ssdpSock = new SSDPNotifySocket(bindAddr); 618 Device.notifyWait(); 619 ssdpSock.post(ssdpReq); // PLACE FIX HERE (by Daniel) ssdpSock.close(); 620 }

      622 public void byebye(String bindAddr)
      623

      { 624 // uuid:device-UUID::urn:schemas-upnp-org:service:serviceType:v 625 626 String devNT = getNotifyServiceTypeNT(); 627 String devUSN = getNotifyServiceTypeUSN(); 628 629 SSDPNotifyRequest ssdpReq = new SSDPNotifyRequest(); 630 ssdpReq.setNTS(NTS.BYEBYE); 631 ssdpReq.setNT(devNT); 632 ssdpReq.setUSN(devUSN); 633 634 SSDPNotifySocket ssdpSock = new SSDPNotifySocket(bindAddr); 635 Device.notifyWait(); 636 ssdpSock.post(ssdpReq); // PLACE FIX HERE (by Daniel) ssdpSock.close(); 637 }

      kind regards,
      Daniel

      Attachments

        Activity

          People

            Unassigned Unassigned
            daniel123 D
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: