These are chat archives for spring-cloud/spring-cloud

17th
Jun 2016
dragontree101
@dragontree101
Jun 17 2016 06:40
i both use spring-boot-start-admin-client and spring-cloud-config-client, i found spring-boot-start-admin to fetch spring-cloud-config , and print log , can i canel this log?
dragontree101
@dragontree101
Jun 17 2016 06:47
i create issue in codecentric/spring-boot-admin#219
Thibaud Lepretre
@kakawait
Jun 17 2016 09:22
Hi, do you think is possible to add x-forwarded-prefix header to a given Zuul route even with stripPrefix: false?
Dave Syer
@dsyer
Jun 17 2016 09:37
What's the use case?
Thibaud Lepretre
@kakawait
Jun 17 2016 09:38
a bit strange but let me explain
Dave Syer
@dsyer
Jun 17 2016 09:38
Normally I wouldn't expect you'd need to
Thibaud Lepretre
@kakawait
Jun 17 2016 09:40

Image following infrastructure: (1) Reverse proxy SSL with context path /foo and (2) Zuul without context path and (3) Microservice BAR with context path /bar.

I have a Zuul route like:

bar-service:
  path: /bar/**
  strip-prefix: false

when request arrives on Zuul with X-Forwarded-Prefix: /foo (added by (1) Reverse Proxy SSL), X-Forwarded-Prefix will be return like that (because prefix is null)

Thus (3) bar-service will recieved X-Forwarded-Prefix: /foo and when using new Spring 4.3 ForwardedHeaderFilter request url will be converted to http://blabla.com/foo instead of (what I whish) http://blabla.com/foo/bar

bar-service must be on other context because it puts some JSESSIONID and I need to avoid conflict domain with Zuul
With prefix and spring-cloud/spring-cloud-netflix#994 normally X-Forwarded-Prefix should be converted to /foo/bar. But it may not the solution of my problem, I may have too strange infra ^^
Dave Syer
@dsyer
Jun 17 2016 09:49
What is it that is rendering the wrong link though?
I would expect the /bar to be part of that logic (since it is the local prefix, not the remote one)
Thibaud Lepretre
@kakawait
Jun 17 2016 09:50
not rendering but redirection fails on 404
Dave Syer
@dsyer
Jun 17 2016 09:50
It's rendering a location header then
Maybe the ForwardedHeaderFilter should append /bar
I don't think it's something that should be fixed in the proxy
Thibaud Lepretre
@kakawait
Jun 17 2016 09:51
SavedRequest keep http://blabla.com/foo/api instead of (what I whish) http://blabla.com/foo/bar/api
Dave Syer
@dsyer
Jun 17 2016 09:51
All the information you need is there in the bar-service
I guess at least that means you can implement a workaround
Thibaud Lepretre
@kakawait
Jun 17 2016 09:52
ok yes but I think I will depends on need between appending or replacing. X-Forwarded-Prefix is not standard btw
Dave Syer
@dsyer
Jun 17 2016 09:52
No, it's a Spring thing.
Thibaud Lepretre
@kakawait
Jun 17 2016 09:52
so both use case is valid :'(
Dave Syer
@dsyer
Jun 17 2016 09:52
But my conclusion is the same
All the data you need are available in the bar-service
You just have to know how to use them
Thibaud Lepretre
@kakawait
Jun 17 2016 09:53
yes I was thinking about implementing my own DefaultRedirectStrategy
Dave Syer
@dsyer
Jun 17 2016 09:53
I would just add a Filter
Thibaud Lepretre
@kakawait
Jun 17 2016 09:53
to append what I need
Dave Syer
@dsyer
Jun 17 2016 09:53
If we need to make a change in Spring I expect it might be in the filter
You don't just want this behaviour for redirects
Thibaud Lepretre
@kakawait
Jun 17 2016 09:54
ho override/replacing ForwardHeaderFilter
Dave Syer
@dsyer
Jun 17 2016 09:54
You want it for all links rendered by the backend
Thibaud Lepretre
@kakawait
Jun 17 2016 09:54
to fit my need
Dave Syer
@dsyer
Jun 17 2016 09:54
Overriding would work.
Or just an extra filter
Thibaud Lepretre
@kakawait
Jun 17 2016 09:54
oki thank you
Dave Syer
@dsyer
Jun 17 2016 09:54
Please open a ticket in SPR JIRA
I thought we got this right once (there was quite a lot of discussion on the original ticket for ForwardHeaderFilter)
Thibaud Lepretre
@kakawait
Jun 17 2016 09:55
but as I said is debatable between replacingor appending on current context-path
but I will open it
SPR team can close it if not agree ^^
Dave Syer
@dsyer
Jun 17 2016 09:55
Indeed
Thibaud Lepretre
@kakawait
Jun 17 2016 09:56
btw I already override (and open issue) existing ForwardHeaderFilter because is not case-insensitive I will do the same for this case
again thank you for your time
Thibaud Lepretre
@kakawait
Jun 17 2016 10:23
issue just opens, I really prefer github rather than jira ^^
Dave Syer
@dsyer
Jun 17 2016 10:48
Me too
I sometimes just open a github issue anyway
The SPR devs just copy it into JIRA.
Sooner or later they will get bored with that and just migrate to github
Can you paste a link here please?
sorry I was afk @dsyer
Tommy Ludwig
@shakuzen
Jun 17 2016 11:59
Related to the following comment in spring-cloud/spring-cloud-config#393, I'm having possibly similar or the same issues being described:
Cases where JGit simply leaves corrupted Git repositories and the config server is unable to recover from this situation itself.
I'm also using an in-house BitBucket server as the backing for Spring Cloud Config, and we sometimes have the production instance get into a bad state that requires manual intervention.
I would have reported an issue on it a while ago, but I'm not able to reliably reproduce the issue at all, and I've spent hours trying. It happens after some time in all our environments, though.
I don't know about the specifics of how the Git repository gets corrupt for the user that left that comment, but for me, the aftermath of it is that if you do a git status on the local repository, you will see something like the following:
# On branch UpdateForLoginCore
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    README.md
#       deleted:    areaapi/areaapi-prod.yml
#       deleted:    areaapi/areaapi-server.yml
#       deleted:    areaapi/areaapi-stg.yml
#       deleted:    configserver/configserver-dev.yml
#       deleted:    configserver/configserver.yml
#       deleted:    cxlpr/cxlpr-dev.yml
#       deleted:    cxlpr/cxlpr-message_en_US.properties
#       deleted:    cxlpr/cxlpr-message_ja_JP.properties
#       deleted:    cxlpr/cxlpr-message_ko_KR.properties
#       deleted:    cxlpr/cxlpr-message_zh_CN.properties
#       deleted:    cxlpr/cxlpr-message_zh_TW.properties
#       deleted:    verify-api/verify-api-dev.yml
#       deleted:    verify-front/verify-front.yml
#       deleted:    zip/zip-dev.properties
#       deleted:    zip/zip.properties
#
The Config Server will act "normal" in this case, but it won't be able to retrieve any of the files that are deleted (not all of the files in the repo are) and therefore can't include them in the properties it returns.
I would really love to nail down this issue. If you have any suggestions for what I could try or provide to investigate it further, I'm open to suggestions.
Dave Syer
@dsyer
Jun 17 2016 12:04
Not all the files are deleted?
So who deleted them?
Tommy Ludwig
@shakuzen
Jun 17 2016 12:04
No, not all of them. Just for added mystery
I wish I knew how they are getting deleted.
Dave Syer
@dsyer
Jun 17 2016 12:05
Is it a backup process restoring an old directory tree?
Tommy Ludwig
@shakuzen
Jun 17 2016 12:06
I doubt it because something like the README should always have been there.
Dave Syer
@dsyer
Jun 17 2016 12:07
You never know.
Files that are deleted and unstaged must have been deleted outside of anything git knows about
So I doubt it is the config server doing it.
Tommy Ludwig
@shakuzen
Jun 17 2016 12:09
True. I guess that does fairly well rule out the config server.
Dave Syer
@dsyer
Jun 17 2016 12:09
Does it fix the problem if you git reset --hard in that directory manually?
Tommy Ludwig
@shakuzen
Jun 17 2016 12:09
Yes
That is the easiest way to fix it
Restarting is the less easy way
Dave Syer
@dsyer
Jun 17 2016 12:09
You could add that to the config server I guess, as a fallback
Tommy Ludwig
@shakuzen
Jun 17 2016 12:11
Certainly would help as a hold-over workaround until I can figure out what's going crazy on our servers.
miguelpuyol
@miguelpuyol
Jun 17 2016 12:14
Hi! First of all thanks for the great work! I really appreciate it. I wanted to ask you if there is any way of configuring Zuul to use different Basic Auth credentials when it communicates to the downstream services it proxies.
  routes:
    myroute:
      path: /mysecuredpath
      username: user
      password: password
thanks in advance
Dave Syer
@dsyer
Jun 17 2016 12:16
Nothing out of the box. You could implement that as a custom filter quite easily though.
miguelpuyol
@miguelpuyol
Jun 17 2016 12:17
thanks for the quick feedback
miguelpuyol
@miguelpuyol
Jun 17 2016 12:34
@dsyer abusing your patience, what filter already existing do you think might be a good example to base my implementation?
Dave Syer
@dsyer
Jun 17 2016 12:36
Any ZuulFilter
You'd want to be able to pick up the service id from the PreDecorationFilter
so copy that one and change the order and the run() method
miguelpuyol
@miguelpuyol
Jun 17 2016 12:39
thanks again
I will do so
do you think this filter might be interesting for a PR?
Dave Syer
@dsyer
Jun 17 2016 12:41
Maybe
It fits in spring-cloud-security
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 18:59
Hello all, I have a method in a @Component annotated class that returns Observable<Long>. I have annotated the config class w/ @EnableHystrix and the method w/ @HystrixCommand. However, I'm seeing all instances of the @HystrixCommand method run sequentially w/in the same thread. Is there something I'm missing that I need to enable this method to run in parallel/separate threads?
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:07
I’m playing with Brixton.SR1 and just found out a strange behavior related to configserver. All my applications keeps reaching configserver every second and logging something like this:
2016-06-17 16:06:36.011  INFO 4529 --- [DiscoveryClient-InstanceInfoReplicator-0] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=application, profiles=[default], label=develop, version=e07e4a146921cd10a3b6be0e3d0d54f65cdbc115
When I was in Brixton.RELEASE it didn’t happen. Is it an expected behaviour?
Spencer Gibb
@spencergibb
Jun 17 2016 19:09
no it isn’t.
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:11
:worried:
Spencer Gibb
@spencergibb
Jun 17 2016 19:12
there’s also no polling built in to config client
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:14
I’ll try to build a sample project
Dave Syer
@dsyer
Jun 17 2016 19:25
Maybe it's just logging something now that wasn't before?
Health check?
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:38
@dsyer I don’t think so because the configserver wasn’t receiving any requests
I’ve done a sample project https://github.com/marcosbarbero/spring-cloud-config-client-polling @spencergibb I’ve noted it’s related to @SpringCloudApplication annotation if I’m using @SpringBootApplication it doesn’t happen
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:51
@spencergibb @dsyer never mind, it’s related to my application.yml from remote repository. I’ll try to find out what’s going on.
Spencer Gibb
@spencergibb
Jun 17 2016 19:53
:-)
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:55
Just did! hehehe
It’s some behaviour related to eureka client and the properties eureka.client.instance-info-replication-interval-seconds, eureka.client.initial-instance-info-replication-interval-seconds
Spencer Gibb
@spencergibb
Jun 17 2016 19:57
hmm, maybe if the eureka healthcheck is turned on
otherwise, those don’t have anything to do with health and config server
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:58
sure
I’ve the healthcheck turned on for Brixton.RELEASE and the Brixton.SR1, only the SR1 keeps polling configserver :D
Spencer Gibb
@spencergibb
Jun 17 2016 19:59
there was a bug fixed in SR1 where it wasn’t really turned on, check the /autoconfig report
Marcos Barbero
@marcosbarbero
Jun 17 2016 19:59
I was fooling myself all this time :worried:
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:00
Who would be the subject matter expert to ask ???'s regarding Hystrix and Async execution in spring cloud?
Spencer Gibb
@spencergibb
Jun 17 2016 20:02
I guess me
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:02
Thanks @spencergibb , is there anything special I need to do to get a bean method to run async besides:
  1. annotate the app w/ @EnableHystrix
  1. Return an observable from the method
  1. Annotate the method w/ @HystrixCommand
Spencer Gibb
@spencergibb
Jun 17 2016 20:04
how are you building the Observable?
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:06
@HystrixCommand(commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "5000")
})
public Observable<Long> cacheWaveForApAsync(Long waveId, String expression, String type) {
return Observable.create(new Observable.OnSubscribe<Long>() {
@Override
public void call(Subscriber<? super Long> observer) {
try {
System.out.println(Thread.currentThread().getId());
… do some other stuff
if (!observer.isUnsubscribed()) {
observer.onNext(waveId);
observer.onCompleted();
}
} catch (Exception e) {
observer.onError(e);
}
}
});
Spencer Gibb
@spencergibb
Jun 17 2016 20:06
it should be on a separate thread by default
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:06
as in "that should work"?
Spencer Gibb
@spencergibb
Jun 17 2016 20:07
so by default the execution mode is eager, maybe try @HystrixCommand(observableExecutionMode = LAZY)
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:07
will try
one sec
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:15
@spencergibb same issue, I see the methods executing in the same thread sequentially
here is how I'm calling it
do you see any issues?
wavePermutation.getWaveIds().forEach(waveId -> {
observableList.add(audienceProfileDao.cacheWaveForApAsync(waveId, audience.getString(), "survey"));
observableList.add(audienceProfileDao.cacheWaveForApAsync(waveId, audience.getString(), "supplemental"));
});
} else {
wavePermutationId = waveMgr.getMaxWavePermutation();
}
Observable.merge(observableList).toBlocking().last();
Spencer Gibb
@spencergibb
Jun 17 2016 20:16
toBlocking()
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:16
that's after the merge though, right?
is there anyway to have those methods execute async, but block until they all return.
*that method
Spencer Gibb
@spencergibb
Jun 17 2016 20:18
{@code BlockingObservable} is a variety of {@link Observable} that provides blocking operators. It can be
useful for testing and demo purposes, but is generally inappropriate for production applications (if you
think you need to use a {@code BlockingObservable} this is usually a sign that you should rethink your
design).
unsure
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:20
thanks, will keep investigating, looking forward to Spring One Platform in Vegas :)
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:35
@spencergibb stepping through the code, it seems that the HystrixObservableCommand constructor was being called w/ "execution.isolation.strategy" set to "semaphore
which is odd because we don't configure that property anywhere in our app
setting it explicitly in the hystrixCommand to "thread" seems to spawn several threads
Spencer Gibb
@spencergibb
Jun 17 2016 20:36
I seem to recall something about that being the default
for HystrixObservableCommand
Netflix/Hystrix#1200
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:37
thanks
Spencer Gibb
@spencergibb
Jun 17 2016 20:37
sorry I didn’t remember that sooner
Sharif Ghazzawi
@Sghazzawi
Jun 17 2016 20:38
np, this get's me progress, appreciate it
Alex Filatov
@sprgn
Jun 17 2016 22:39
In config-server, is there a way to serve plain text files and instruct config-server to not resolve property place holders? Like with resolvePlaceholders in yml and properties files?
Spencer Gibb
@spencergibb
Jun 17 2016 22:59
not currently