Hi all,

I am working on Beryllium-SR2 and faced a problem that notification could not 
be properly handled when we configured more than 180 devices with openflow. I 
think the reason may be LLDPDiscoveryListener class which handles the 
notification, however also publishes notification in the same thread. 

Following is the stack trace of the notification thread when problem appears.
"pool-29-thread-1" #828 prio=5 os_prio=0 tid=0x00007f8f25816000 nid=0x650f 
runnable [0x00007f91b5c85000]
   java.lang.Thread.State: TIMED_WAITING (parking)
         at sun.misc.Unsafe.park(Native Method)
         at 
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:338)
         at 
com.lmax.disruptor.MultiProducerSequencer.next(MultiProducerSequencer.java:136)
         at 
com.lmax.disruptor.MultiProducerSequencer.next(MultiProducerSequencer.java:105)
         at com.lmax.disruptor.RingBuffer.next(RingBuffer.java:246)
         at 
org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter.putNotification(DOMNotificationRouter.java:200)
         at 
org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter.putNotification(BindingDOMNotificationPublishServiceAdapter.java:51)
         at 
org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter.publish(HeliumNotificationProviderServiceAdapter.java:33)
         at 
org.opendaylight.controller.md.sal.binding.util.AbstractBindingSalProviderInstance.publish(AbstractBindingSalProviderInstance.java:49)
         at 
org.opendaylight.openflowplugin.applications.topology.lldp.LLDPDiscoveryListener.onPacketReceived(LLDPDiscoveryListener.java:38)
         at 
java.lang.invoke.LambdaForm$DMH/576349521.invokeInterface_LL_V(LambdaForm$DMH)
         at java.lang.invoke.LambdaForm$BMH/1978006025.reinvoke(LambdaForm$BMH)
         at 
java.lang.invoke.LambdaForm$MH/895324468.invokeExact_MT(LambdaForm$MH)
         at 
org.opendaylight.yangtools.yang.binding.util.NotificationListenerInvoker.invokeNotification(NotificationListenerInvoker.java:91)
         at 
org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationListenerAdapter.onNotification(BindingDOMNotificationListenerAdapter.java:44)
         at 
org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouterEvent.deliverNotification(DOMNotificationRouterEvent.java:56)
         at 
org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter$1.onEvent(DOMNotificationRouter.java:68)
         at 
org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter$1.onEvent(DOMNotificationRouter.java:65)
         at 
com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:128)
         at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
         at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
         at java.lang.Thread.run(Thread.java:745)

We did some test by changing the LLDPDiscoveryListener class as followings( red 
color), and the problem above was gone. So please help us confirm this problem 
and give us some advice.
class LLDPDiscoveryListener implements PacketProcessingListener {
    private static final Logger LOG = 
LoggerFactory.getLogger(LLDPDiscoveryListener.class);
    private static final ExecutorService executorService = 
Executors.newSingleThreadExecutor();

    private LLDPLinkAger lldpLinkAger;
    private NotificationProviderService notificationService;

    LLDPDiscoveryListener(NotificationProviderService notificationService) {
        this.notificationService = notificationService;
    }

    public void onPacketReceived(PacketReceived lldp) {
        NodeConnectorRef src = 
LLDPDiscoveryUtils.lldpToNodeConnectorRef(lldp.getPayload(), true);
        if(src != null) {
            LinkDiscoveredBuilder ldb = new LinkDiscoveredBuilder();
            ldb.setDestination(lldp.getIngress());
            ldb.setSource(new NodeConnectorRef(src));
            final LinkDiscovered ld = ldb.build();

            executorService.execute(new Runnable() {
                @Override
                public void run() {
                    notificationService.publish(ld);
                    lldpLinkAger.put(ld);
                }
            });
        }
    }

    public void setLldpLinkAger(LLDPLinkAger lldpLinkAger) {
        this.lldpLinkAger = lldpLinkAger;
    }
}

Thanks again and best regards.
Qishun Jiao


 
_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to