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. Ported from master branch. Change-Id: I810e697a29f387dbff8e6f353c862d30930d2825
Showing
1 changed file
with
6 additions
and
2 deletions
... | @@ -107,7 +107,7 @@ public class PacketManager | ... | @@ -107,7 +107,7 @@ public class PacketManager |
107 | @Activate | 107 | @Activate |
108 | public void activate() { | 108 | public void activate() { |
109 | eventHandlingExecutor = Executors.newSingleThreadExecutor( | 109 | eventHandlingExecutor = Executors.newSingleThreadExecutor( |
110 | - groupedThreads("onos/net/packet", "event-handler")); | 110 | + groupedThreads("onos/net/packet", "event-handler")); |
111 | appId = coreService.getAppId(CoreService.CORE_APP_NAME); | 111 | appId = coreService.getAppId(CoreService.CORE_APP_NAME); |
112 | store.setDelegate(delegate); | 112 | store.setDelegate(delegate); |
113 | deviceService.addListener(deviceListener); | 113 | deviceService.addListener(deviceListener); |
... | @@ -281,7 +281,11 @@ public class PacketManager | ... | @@ -281,7 +281,11 @@ public class PacketManager |
281 | public void processPacket(PacketContext context) { | 281 | public void processPacket(PacketContext context) { |
282 | // TODO filter packets sent to processors based on registrations | 282 | // TODO filter packets sent to processors based on registrations |
283 | for (PacketProcessor processor : processors.values()) { | 283 | for (PacketProcessor processor : processors.values()) { |
284 | - processor.process(context); | 284 | + try { |
285 | + processor.process(context); | ||
286 | + } catch (Exception e) { | ||
287 | + log.warn("Packet processor {} threw an exception", processor, e); | ||
288 | + } | ||
285 | } | 289 | } |
286 | } | 290 | } |
287 | 291 | ... | ... |
-
Please register or login to post a comment