[ https://issues.apache.org/jira/browse/GEODE-10035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17522510#comment-17522510 ]
ASF subversion and git services commented on GEODE-10035: --------------------------------------------------------- Commit 092ebbfef306ccd78271f8b810c310589ae42266 in geode's branch refs/heads/develop from Darrel Schneider [ https://gitbox.apache.org/repos/asf?p=geode.git;h=092ebbfef3 ] GEODE-10035: fix BufferPool sys prop logic (#7587) Now if either system property is set to true that takes precedence and heap buffers will be used. Otherwise, direct buffers will be used. > The System property condition to use "direct" ByteBuffers in P2P is wrong > ------------------------------------------------------------------------- > > Key: GEODE-10035 > URL: https://issues.apache.org/jira/browse/GEODE-10035 > Project: Geode > Issue Type: Bug > Affects Versions: 1.14.3 > Reporter: John Blum > Assignee: Darrel Schneider > Priority: Minor > Labels: pull-request-available > > In the {{o.a.g.internal.net.ByteBuffer.useDirectBuffers}} class member > (static) constant field > ([source|https://github.com/apache/geode/blob/rel/v1.14.3/geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java#L82-L83]), > which is derived from either the "{{p2p.nodirectBuffers"}} OR the > "{{gemfire.BufferPool.useHeapBuffers}}" System properties, the conditional > logic is incorrect! > It should read (formatted to make it more readable): > {code:java} > public static final boolean useDirectBuffers = !( > Boolean.getBoolean("p2p.nodirectBuffers") > || > Boolean.getBoolean(GeodeGlossary.GEMFIRE_PREFIX+"BufferPool.useHeapBuffers") > ); > {code} > Alternatively: > {code:java} > public static final boolean useDirectBuffers = > !Boolean.getBoolean("p2p.nodirectBuffers") > && > !Boolean.getBoolean(GeodeGlossary.GEMFIRE_PREFIX+"BufferPool.useHeapBuffers"); > {code} > That is, if either the "{{p2p.nodirectBuffers}}" OR the > "{{gemfire.BufferPool.useHeapBuffers}}" System properties are {{true}}, then > DO NOT USE direct ByteBuffers. > The term "{{useHeapBuffers}}" implies that the buffer should be created on > the JVM Heap, and not in main memory as a "direct" ByteBuffer. > Setting the System property "{{gemfire.BufferPool.useHeapBuffers}}" to > "{{true}}" would result in a direct ByteBuffer allocation as can be seen > [here|https://github.com/apache/geode/blob/rel/v1.14.3/geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java#L104-L115], > > rather than what should happen > [here|https://github.com/apache/geode/blob/rel/v1.14.3/geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java#L117]. > As the condition currently stands, if the "{{p2p.nodirectBuffers}}" System > property is not set at all (which results in {{Boolean.getBoolean(..)}} > returning {{false}}), which negated results in the OR'd condition not even > being evaluated! -- This message was sent by Atlassian Jira (v8.20.1#820001)