flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-4087) JMXReporter can't handle port conflicts
Date Fri, 24 Jun 2016 13:19:16 GMT

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

ASF GitHub Bot commented on FLINK-4087:
---------------------------------------

Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2145#discussion_r68396189
  
    --- Diff: flink-core/src/main/java/org/apache/flink/metrics/reporter/JMXReporter.java
---
    @@ -265,4 +329,72 @@ public Object getValue() {
     			return gauge.getValue();
     		}
     	}
    +
    +	/**
    +	 * JMX Server implementation that JMX clients can connect to.
    +	 *
    +	 * Heavily based on j256 simplejmx project
    +	 *
    +	 * https://github.com/j256/simplejmx/blob/master/src/main/java/com/j256/simplejmx/server/JmxServer.java
    +	 */
    +	private static class JMXServer {
    +		private int port;
    +		private Registry rmiRegistry;
    +		private JMXConnectorServer connector;
    +
    +		public JMXServer(int port) {
    +			this.port = port;
    +		}
    +
    +		public void start() throws IOException {
    +			startRmiRegistry();
    +			startJmxService();
    +		}
    +
    +		public void stop() throws IOException {
    +			if (connector != null) {
    +				try {
    +					connector.stop();
    +				} finally {
    +					connector = null;
    +				}
    +			}
    +			if (rmiRegistry != null) {
    +				try {
    +					UnicastRemoteObject.unexportObject(rmiRegistry, true);
    +				} catch (NoSuchObjectException e) {
    +					throw new IOException("Could not unexport our RMI registry", e);
    +				} finally {
    +					rmiRegistry = null;
    +				}
    +			}
    +		}
    +
    +		private void startRmiRegistry() throws IOException {
    +			if (rmiRegistry != null) {
    +				return;
    +			}
    +			rmiRegistry = LocateRegistry.createRegistry(port);
    +		}
    +
    +		private void startJmxService() throws IOException {
    +			if (connector != null) {
    +				return;
    +			}
    +			String serverHost = "localhost";
    +			String registryHost = "";
    +			String serviceUrl =
    +				"service:jmx:rmi://" + serverHost + ":" + port + "/jndi/rmi://" + registryHost +
":" + port + "/jmxrmi";
    --- End diff --
    
    No, it does not allow connecting via remote. This also applies to the current version.

    
    I also remembered that this was not considered a required feature during implementation.


> JMXReporter can't handle port conflicts
> ---------------------------------------
>
>                 Key: FLINK-4087
>                 URL: https://issues.apache.org/jira/browse/FLINK-4087
>             Project: Flink
>          Issue Type: Improvement
>          Components: Metrics
>    Affects Versions: 1.1.0
>            Reporter: Chesnay Schepler
>            Assignee: Chesnay Schepler
>            Priority: Blocker
>             Fix For: 1.1.0
>
>
> The JMXReporter is currently configured to use a single port that is set as a JVM argument.
> This approach has a few disadvantages:
> If multiple TaskManagers run on the same machine only 1 can expose metrics. This issue
is compounded by the upcoming JobManager metrics, which would then prevent TM metrics from
being exposed in local setups.
> Currently, we prevent other TM's from exposing metrics by checking the the start-daemon-sh
whether a TM is already running, and if so clear the arguments. This isn't a particular safe
way to do it, and this script is not used when deploying on yarn, leading to TM failures since
the JVM can't allocate the JMX port.
> We should find a way to specifiy port-ranges for JMX and log the final port used.



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

Mime
View raw message