-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix stop-edge.sh not stopping its own process when IOTDB_HOME is set #18546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PDGGK
wants to merge
4
commits into
apache:master
Choose a base branch
from
PDGGK:fix-edge-stop-home
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
73a96dc
Fix stop-edge.sh failing to stop its own process when IOTDB_HOME is set
PDGGK 739dae2
Address review: resolve physically and only match absolute process homes
PDGGK cd4d7ef
Normalise IOTDB_HOME to a physical absolute path in start-edge.sh
PDGGK 25dbf74
Note why the fallback rejects an empty process home
PDGGK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Resolve relative process homes using the process's working directory
start-edge.shacceptsIOTDB_HOME=.and passes it unchanged to the JVM. If an instance was started this way in/srv/edge-a, running/srv/edge-b/sbin/stop-edge.shfrom/srv/edge-bwithIOTDB_HOMEunset resolves the process's.to B. Consequently,find_edge_processesconsiders A a match and terminates it, even if B has no PID file or running instance. The base script rejects this process; the new fallback accepts it.Please normalize the home to a physical absolute path at launch, or resolve relative process values against that process's working directory; do not resolve them against the stopping shell's working directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, and thank you for running it. I reproduced it before changing
anything: a synthetic process with
cwdinedge-aand-DIOTDB_HOME=.on itscommand line, stopped from
edge-b-- the base script correctly declines it, myfallback resolved the
.against the stopping shell and terminated it.I have taken the first of your two suggestions.
start-edge.shnow normalisesIOTDB_HOMEto a physical absolute path before exporting it, so the value handedto the JVM identifies the installation on its own:
I kept an absolute-path guard in the
stop-edge.shfallback as well, rather thanrelying only on the launcher. A process started by an earlier
start-edge.shduring an upgrade can still carry a relative value, and for those the fallback now
declines instead of resolving against our own directory -- the same outcome as the
base script. That leaves resolving against the process's working directory
unnecessary, which I was reluctant to do since it needs
lsofor/procand awrong answer there puts us back to stopping the wrong process.
Two things about the normalisation that I would rather state than leave to be
found. It changes the path string that appears in
ps, in the console message andin the logs -- on this machine
/tmpbecomes/private/tmp-- which is the pointof the change, but anything grepping for the old string is affected. And if the
cd -Pcannot run,IOTDB_HOMEkeeps the value it had, which for the unset caseis still relative; that instance then falls to the literal comparison in
stop-edge.sh, which is today's behaviour. A fallback to a logicalcddoes nothelp here: both still have to reach the directory, so it fails on the same inputs.
Both of your cases are in the regression set now, with the version you reviewed as
a control so they are shown to fail without the change.