cybergarage / cybergarage-upnp

cybergarage-upnp is a development package for UPnP™ developers. cybergarage-upnp controls these protocols automatically, and supports to create your devices and control points quickly.

Home Page:http://www.cybergarage.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multithreaded Synchronization Crash

jonruiz opened this issue · comments

I posted this in the forum, then realized I should open an issue:

I've been seeing the following crash in the field with the CyberLink for Java code:

java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at java.util.Vector.arrayIndexOutOfBoundsException(Vector.java:907)
at java.util.Vector.elementAt(Vector.java:328)
at java.util.Vector.get(Vector.java:442)
at org.cybergarage.xml.NodeList.getNode(GraceRemote:28)
at org.cybergarage.upnp.ControlPoint.getDeviceList(GraceRemote:313)
at org.cybergarage.upnp.ControlPoint.renewSubscriberService$1349ef(GraceRemote:860)
at org.cybergarage.upnp.ControlPoint.renewSubscriberService(GraceRemote:871)
at org.cybergarage.upnp.control.RenewSubscriber.run(GraceRemote:69)
at java.lang.Thread.run(Thread.java:856)

This is occurring on the renewsubscriber thread. There's another thread for removing expired devices. The renew iterates through the devNodeList, the remove deletes entries from the devNodeList and there's no synchronization between the two. Has anyone else seen this problem? Is it as simple as synchronizing the getDevice() and removeDevice() calls? I'm only seeing this in anonymous crash reports, and it's not common, so reproducing and testing isn't an option.