diff --git a/ChangeLog.txt b/ChangeLog.txt index e2c8e115..284d8e9b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -14,6 +14,7 @@ Version 0.7: Modified the password_file format to use password stored in sha256 and not plain text Added ACL file for topic read|write operations. Removed cause of leakage of Netty Sessions (fix issue #39) + Cleaned Netty's stuff reference from Events used in Disruptor (fix issue #40) Version 0.6: Fix issue #42, bad password file path composition diff --git a/broker/src/main/java/org/eclipse/moquette/spi/impl/ProtocolProcessor.java b/broker/src/main/java/org/eclipse/moquette/spi/impl/ProtocolProcessor.java index 01b20713..8f422e4c 100644 --- a/broker/src/main/java/org/eclipse/moquette/spi/impl/ProtocolProcessor.java +++ b/broker/src/main/java/org/eclipse/moquette/spi/impl/ProtocolProcessor.java @@ -667,11 +667,15 @@ class ProtocolProcessor implements EventHandler { } public void onEvent(ValueEvent t, long l, boolean bln) throws Exception { - MessagingEvent evt = t.getEvent(); - //It's always of type OutputMessagingEvent - OutputMessagingEvent outEvent = (OutputMessagingEvent) evt; - LOG.debug("Output event, sending {}", outEvent.getMessage()); - outEvent.getChannel().write(outEvent.getMessage()); + try { + MessagingEvent evt = t.getEvent(); + //It's always of type OutputMessagingEvent + OutputMessagingEvent outEvent = (OutputMessagingEvent) evt; + LOG.debug("Output event, sending {}", outEvent.getMessage()); + outEvent.getChannel().write(outEvent.getMessage()); + } finally { + t.setEvent(null); //free the reference to all Netty stuff + } } } diff --git a/broker/src/main/java/org/eclipse/moquette/spi/impl/SimpleMessaging.java b/broker/src/main/java/org/eclipse/moquette/spi/impl/SimpleMessaging.java index ac8c3efe..667c56d6 100644 --- a/broker/src/main/java/org/eclipse/moquette/spi/impl/SimpleMessaging.java +++ b/broker/src/main/java/org/eclipse/moquette/spi/impl/SimpleMessaging.java @@ -153,6 +153,7 @@ public class SimpleMessaging implements IMessaging, EventHandler { @Override public void onEvent(ValueEvent t, long l, boolean bln) throws Exception { MessagingEvent evt = t.getEvent(); + t.setEvent(null); //free the reference to all Netty stuff LOG.info("onEvent processing messaging event from input ringbuffer {}", evt); if (evt instanceof StopEvent) { processStop();