Jonathan Hart
Committed by Gerrit Code Review

Protect against exceptions thrown in application's packet processors.

These exceptions should not bubble up to netty because that will result in the
connection to the switch being closed.

For now we catch and log the exception - in the future we could consider removing
misbehaving packet processors.

Addresses ONOS-3368.

Change-Id: If507adafba39bf705c27286c8e48af3f955d1eff
...@@ -312,9 +312,13 @@ public class PacketManager ...@@ -312,9 +312,13 @@ public class PacketManager
312 public void processPacket(PacketContext context) { 312 public void processPacket(PacketContext context) {
313 // TODO filter packets sent to processors based on registrations 313 // TODO filter packets sent to processors based on registrations
314 for (ProcessorEntry entry : processors) { 314 for (ProcessorEntry entry : processors) {
315 - long start = System.nanoTime(); 315 + try {
316 - entry.processor().process(context); 316 + long start = System.nanoTime();
317 - entry.addNanos(System.nanoTime() - start); 317 + entry.processor().process(context);
318 + entry.addNanos(System.nanoTime() - start);
319 + } catch (Exception e) {
320 + log.warn("Packet processor {} threw an exception", entry.processor(), e);
321 + }
318 } 322 }
319 } 323 }
320 324
......