-
Notifications
You must be signed in to change notification settings - Fork 709
Cloud config client reversing remote property sources with certain settings #668
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
Comments
I'm unable to replicate the problem. Can you please provide the configuration and build files for the client and server (if not a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.) |
https://github.com/pcornelissen/spring-cloud-bug-668 shows that the error occurs in SR1 but not in the release version |
I don't think these are related, but I could be wrong. |
After adding boot web and actuator I see the reversed property sources as mentioned above. |
Indeed, swapping the collections iterated over does fix the problem. Now to write a test. |
This fixes as revered property source bug. fixes gh-668
FYI PR with test #670 |
This fixes as reversed property source bug. fixes gh-668
@jeffbswope and @pcornelissen after snapshots are built would you test? |
@spencergibb Confirmed with |
FYI: in hoxton.SR2 the config client version is:
So the bug is not fixed in SR2! |
Ah yes, it will be in sr3 in a week |
@spencergibb This bug also seems to appear in Greenwich.SR5. |
@spencergibb I hit this issue with Greenwich.SR5 also with spring-cloud-commons 2.1.5.RELEASE. Will you guys be fixing the issues in Greenwich for this and #704 ? |
@maximusfloydus likely. Greenwich has entered a special maintenance mode. Likely what will happen is that there would be a commons 2.1.6.RELEASE without a Greenwich.SR6 |
I've created #712 to track this. |
This fixes as revered property source bug. fixes gh-668
* Adjusts ordering when override system properties is false. This fixes as revered property source bug. fixes gh-668 * Updates ContextRefresher to maintain property source ordering. Updates the targetName so that property sources maintain ordering from the bootstrap environment where they were refreshed. Fixes gh-704 * Removes proxyBeanMethods = false not available in boot 2.1.x * formatting * Bumps to build 2.1.11.BUILD-SNAPSHOT and version to 2.1.6
There seems to be a regression in Hoxton.SR1 (
spring-cloud-context:2.2.1.RELEASE
) which results in the property sources returned by the cloud config server being reversed on the client when settings dictate to position them relative to the system properties source.This code incorrectly reverses the order of the property sources in the original incoming
composite
:https://github.com/spring-cloud/spring-cloud-commons/blob/master/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/config/PropertySourceBootstrapConfiguration.java#L196-L198
As does this code:
https://github.com/spring-cloud/spring-cloud-commons/blob/master/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/config/PropertySourceBootstrapConfiguration.java#L201-L203
(The former should be iterating on the
reversedComposite
so that.addAfter
unfurls them in their original order, and the latter vice-versa.)The first block is hit when the following settings exist:
As an aside, the second block on line 201-203 appears to be dead code? If
remoteProperties.isOverrideSystemProperties()
then we seem to return on line 186 if!remoteProperties.isOverrideNone()
and line 192 ifremoteProperties.isOverrideNone()
, assuming those are non-volitile. I'm not sure what assumptions are being made about which sources might be in the environment when this is hit, but it seems like "not first, not last, but before system properties" and "first" are treated as equivalent on 181-182 such that lines 201-203 aren't needed. This might just be dodging some complexity aroundsystemProperties
vs.systemEnvironment
and fallback when one or both are missing?As requested on Gitter, a heavily pruned/redacted result of
/actuator/env
on a client with these settings in Hoxton.SR1, where thebootstrapProperties-ssh://...
sources are in the opposite order as returned from the config server atconfig-server:8888/my-app-name/foo
:The text was updated successfully, but these errors were encountered: