Bug 4473 - Concentrate multipart-reply (table features) exception logs 53/33653/1
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Wed, 27 Jan 2016 18:41:07 +0000 (19:41 +0100)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Wed, 27 Jan 2016 18:41:11 +0000 (19:41 +0100)
 - prevents log from flooding by unsupported structures in table features
 - OVS 2.4 related issue

Change-Id: I07ca50074b0ac47047e6067ee22b1b3ec5414bc5
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java

index f5d0c2bace6dcb9af04c87f5e9d0dc519f35688b..905eefd7cec41272b825e405cf67afd4e8bd513b 100644 (file)
@@ -72,14 +72,20 @@ public final class ListDeserializer {
         if (input.readableBytes() > 0) {
             items = new ArrayList<>();
             int startIndex = input.readerIndex();
+            boolean exceptionLogged = false;
             while ((input.readerIndex() - startIndex) < length){
                 HeaderDeserializer<E> deserializer;
                 MessageCodeKey key = keyMaker.make(input);
                 try {
                     deserializer = registry.getDeserializer(key);
                 } catch (ClassCastException | IllegalStateException e) {
-                    LOG.warn("Problem during reading table feature property. Skipping unknown feature property: {}",
-                        key, e);
+                    if (!exceptionLogged) {
+                        LOG.warn("Problem during reading table feature property. Skipping unknown feature property: {}",
+                                key, e);
+                        LOG.warn("This exception is logged only once for each multipart reply (table features) to "
+                                + "prevent log flooding. There might be more of table features related exceptions.");
+                        exceptionLogged = true;
+                    }
                     input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
                     continue;
                 }