Fix race condition in ProcessesSync causing SSH key mismatch#5012
Draft
philippthun wants to merge 1 commit intocloudfoundry:mainfrom
Draft
Fix race condition in ProcessesSync causing SSH key mismatch#5012philippthun wants to merge 1 commit intocloudfoundry:mainfrom
philippthun wants to merge 1 commit intocloudfoundry:mainfrom
Conversation
44475cf to
2db1fc1
Compare
The sync could update an LRP with stale SSH route data from a previous
version when the process version changed between the initial scan and
the batch execution.
Timeline of the race condition:
Sync User Request
---- ------------
| |
| fetch diego LRPs |
| (gets {guid}-{vA} with SSH key A) |
| |
| scan CC processes |
| process has version A, matches |
| to_update[id] = diego_lrp_A |
| |
| | update process
| | version changes to B
| |
| | desire_app called
| | creates {guid}-{vB}
| | with new SSH key B
| |
| re-fetch process by id |
| (now has version B) |
| |
| update_app(process_vB, diego_lrp_A) |
| process_guid = {guid}-{vB} |
| but uses SSH route from diego_lrp_A! |
| |
v v
Result: LRP {guid}-{vB} has SSH key A in routes but SSH key B in
run_info (sshd arguments), breaking cf ssh.
Fix: Before executing desire/update, verify the process version still
matches what was recorded during the initial scan. Skip if mismatched -
the next sync cycle will handle it correctly.
Co-authored-by: Jochen Ehret <jochen.ehret@sap.com>
2db1fc1 to
55641e7
Compare
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 sync could update an LRP with stale SSH route data from a previous version when the process version changed between the initial scan and the batch execution.
Timeline of the race condition:
Result: LRP {guid}-{vB} has SSH key A in routes but SSH key B in run_info (sshd arguments), breaking cf ssh.
Fix: Before executing desire/update, verify the process version still matches what was recorded during the initial scan. Skip if mismatched - the next sync cycle will handle it correctly.
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests