You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Daniel Felsing (JIRA)" <ji...@apache.org> on 2008/08/04 10:45:44 UTC

[jira] Created: (FELIX-657) Devices get lost after a certain period of time (SSDP sockets do not get closed properly in cyberlink lib)

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

                 Key: FELIX-657
                 URL: https://issues.apache.org/jira/browse/FELIX-657
             Project: Felix
          Issue Type: Bug
          Components: UPnP Subproject
    Affects Versions: upnp-basedriver-0.8.0
            Reporter: Daniel Felsing
             Fix For: upnp-basedriver-0.8.0


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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-657) Devices get lost after a certain period of time (SSDP sockets do not get closed properly in cyberlink lib)

Posted by "Francesco Furfari (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-657?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Francesco Furfari closed FELIX-657.
-----------------------------------

    Resolution: Fixed

Fixed in CyberDomo 1.9 

> Devices get lost after a certain period of time (SSDP sockets do not get closed properly in cyberlink lib)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-657
>                 URL: https://issues.apache.org/jira/browse/FELIX-657
>             Project: Felix
>          Issue Type: Bug
>          Components: UPnP Subproject
>    Affects Versions: upnp-basedriver-0.8.0
>            Reporter: Daniel Felsing
>             Fix For: upnp-basedriver-0.8.0
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.