ENG-27785: allow port-only for -m, require host for -b#21
Merged
benjaminballard merged 4 commits intomasterfrom Jun 16, 2025
Merged
ENG-27785: allow port-only for -m, require host for -b#21benjaminballard merged 4 commits intomasterfrom
benjaminballard merged 4 commits intomasterfrom
Conversation
dave-voltdb
reviewed
Jun 11, 2025
src/main/java/org/voltdb/meshmonitor/cli/InetSocketAddressConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/voltdb/meshmonitor/cli/InetSocketAddressConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/voltdb/meshmonitor/cli/MetricsInetSocketAddressConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/voltdb/meshmonitor/cli/MetricsInetSocketAddressConverter.java
Outdated
Show resolved
Hide resolved
dave-voltdb
approved these changes
Jun 13, 2025
| private boolean portInValidRange(int port) { | ||
| return port >=1 && port <= 65535; | ||
| } | ||
| } |
|
|
||
| @Override | ||
| protected boolean requiresHostname() { | ||
| return true; |
There was a problem hiding this comment.
Does this mean you only listen on a single interface?
Contributor
Author
There was a problem hiding this comment.
requiresHostname = true means the user must provide some sort of hostname. It could be [:::] or 0.0.0.0, or locahost, but it can't be empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous ENG-27785 change setting the default value to "12223" for the -m metrics bind address caused meshmonitor to crash with a port already in use exception, unless you provided -m "0.0.0.0:12223" which I've used successfully as a workaround to get data to Prometheus. Now I'm circling back to fix this.
PicoCLI handles the CLI argument parsing, but in the case of the -b and -m options, and the parameter (optional list of hostnames), since these are mapped to InetSocketAddress attributes, PicoCLI does not provide a built-in converter to this type. This project has used a custom converter class to handle parsing these inputs to InetSocketAddress output, but it treated the absence of ":" as a hostname-only address, not a port-only address. So for -m 12223, rather than getting that port with the wildcard host, it converted the integer 12223 to the IP address "0.0.47.191" and tacked on the default port 12222 (which should only be used for -b, not for -m). Hence the metrics http server came up trying to use port 12222 which was already in use by meshmonitor.
I've created a new separate converter for -m, which allows port-only, and handles IPv4 and IPv6 hosts if provided.
I could have left the existing converter alone for -b and the parameter list, but it only works if the FQDN or ip address is provided, so setting -b and providing a hostname should be required.