Copilot commented on code in PR #5346:
URL: https://github.com/apache/solr/pull/5346#discussion_r4575013223
##########
solr/core/src/java/org/apache/solr/cli/SolrProcessManager.java:
##########
@@ -154,6 +161,24 @@ private Optional<Integer>
parsePortFromProcess(ProcessHandle ph) {
return portStr.isPresent() ? portStr.map(Integer::parseInt) :
Optional.empty();
}
+ /**
+ * Finds the Jetty stop port of a running node from its {@code -DSTOP.PORT}
argument, falling back
+ * to the port that {@code bin/solr} derives when nothing was configured.
+ */
+ private int parseStopPortFromProcess(ProcessHandle ph, int port) {
+ for (String arg : arguments(ph)) {
Review Comment:
This returns the first `-DSTOP.PORT`, but the JVM uses the last occurrence.
When startup supplies duplicate properties (for example, through `SOLR_OPTS`),
discovery can select the wrong port, causing graceful shutdown to fail and fall
back to forced termination. Scan the arguments in reverse order and cover
duplicate properties in the process-manager test.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]