You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/12/01 14:10:11 UTC

[GitHub] [kafka] C0urante commented on a diff in pull request #12898: optimize: -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT

C0urante commented on code in PR #12898:
URL: https://github.com/apache/kafka/pull/12898#discussion_r1037153804


##########
bin/kafka-run-class.sh:
##########
@@ -212,7 +212,7 @@ fi
 
 # JMX port to use
 if [  $JMX_PORT ]; then
-  KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT "
+  KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT $KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT "

Review Comment:
   Thanks @reta. To your point--in general, if users want to rely on this undocumented behavior of prioritizing the rightmost value for a system property, they can also use the `$KAFKA_OPTS` variable to declare overrides in case they do not want to alter, e.g., `$KAFKA_JMX_OPTS`.
   
   @a364176773 I understand the desire to simplify implementation, but I'm also trying to satisfy two important principles of bug-squashing:
   1. Limit changes only to the areas that are known to be broken (which in this case, is when the `$JMX_PORT` variable is specified but not the `com.sun.management.jmxremote.rmi.port` system property)
   2. Avoid depending on platform-specific behavior that is not guaranteed by a specification, docs, etc. (which in this case is the prioritization of the rightmost value for a system property on the command line when invoking `java`)
   
   I think the cost of an extra `grep` invocation is a reasonable tradeoff to pay in order to satisfy these tenets, and would like to see that before merging.
   
   Another committer may disagree and feel comfortable merging these changes as-are, but given my limited familiarity with RMI, I'm hesitant to merge this on my own without making absolutely sure that it will have no unintended consequences.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org