You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Keith Wall (JIRA)" <ji...@apache.org> on 2016/10/03 21:20:20 UTC

[jira] [Commented] (QPID-7272) [Java Broker] Direct memory QpidByteBuffer created in message conversion modules should be disposed as soon as possible after becoming unused

    [ https://issues.apache.org/jira/browse/QPID-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15543463#comment-15543463 ] 

Keith Wall commented on QPID-7272:
----------------------------------

I can see three ways to fix this:

# {{MessageConverter#convert()}} methods produce a {{ServerMessage}} which encapsulates a {{StoredMessage}}.  StoredMessages have a #remove() method.  We could give the #remove responsibility for disposing any QBBs allocated by the converter.  The disadvantage with this is the ConsumerTargets need to remember to call #remove on StoredMessages that arise from conversion, but otherwise not.  This seems ugly.  Also this approach seems unpleasant for another reason: a converted  {{ServerMessage}} exposes the message's content but it does not own it.  I might expect that calling  #remove would also dispose the content, but it would not.
# Add method {{MessageConverter#dispose(N)}} which would accept a {{ServerMessage}} that was previously produced by the same converter.  The {{#dispose()}}  implementation would know how to dispose ServerMessages that it produced.  The {{ConsumerTarget#send}} would need to keep a reference to the converter and remember to call {{MessageConverter#dispose(N)}} once the message is passed to the protocol layer.
# Make the {{MessageConverter}} stateful. It would remember the resources that it produced and need to be released.  The {{ConsumerTarget}} would call {{MessageConverter#releaseResources}} after the converted message is passed to the protocol layer.  To avoid creating per-message converter garbage, the {{ConsumerTarget}} would need to cache the MessageConverters that it had used so far.  For this the MessageConverterRegistry would need to turn into a MessageConverterFactoryRegistry.

I am in favour 2). I think this will be unobtrusive change and could be incorporated in 6.1.



> [Java Broker] Direct memory QpidByteBuffer created in message conversion modules should be disposed as soon as possible after becoming unused
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-7272
>                 URL: https://issues.apache.org/jira/browse/QPID-7272
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: qpid-java-6.0
>            Reporter: Alex Rudyy
>             Fix For: qpid-java-7.0.0
>
>
> Direct memory QpidByteBuffer in MessageConverter_to_1_0#convertServerMessage(...) is not disposed programmatically. We rely on GC to release it from memory when it became unused. There is a risk that when such QpidByteBuffers are not "garbage collected" soon enough Broker might run out of direct memory on heavy loads.
> Currently a user who relies heavily of message conversion with high rates of message flow, may see an OOM direct.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org