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

7th
Jun 2018
Yang Lifan
@yanglifan
Jun 07 2018 03:23
There is a question on Spring Cloud Consul. In multi-dc environment, if a service needs to call another service which is located in different dc, this config is necessary spring.cloud.consul.discovery.datacenters.STORES=dc-west. This kinds of config is not smart and will make the configuration of applications chaos. Will it be improved in the future?
CH4:D
@chad_d_stud_twitter
Jun 07 2018 05:05
@marcosbarbero i tried extending zuulexception but it requires me to call the super constructor which practically still renders the same output as before. my override doesn’t work from that point anymore :worried:
Marcos Barbero
@marcosbarbero
Jun 07 2018 06:14
Bummer
pablo-u
@pablo-u
Jun 07 2018 07:46

Hello guys! I have a question regarding feign+hystrix+ribbon.
I understand ribbon includes a timeout & retry behavior which can be configured, but I just can't manage to configure it.
According to the documentation I made the following global configuration:
ribbon:
MaxAutoRetries: 0
MaxAutoRetriesNextServer: 0
ReadTimeout: 3000

But it keeps on waiting 60 seconds and retrying every time it fails

I have the following configuration in my pom:

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
<dependency>
<groupId>com.netflix.ribbon</groupId>
<artifactId>ribbon</artifactId>
<version>2.2.2</version>
</dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-hystrix</artifactId>
    </dependency>
i tried using different dependencies for ribbon but still can't manage to have it understand my configuration
Ryan Baxter
@ryanjbaxter
Jun 07 2018 11:25
what version?
Jared Olhoft
@jarheadjred
Jun 07 2018 11:28
I'm doing rest api documentation using @AutconfigureRestDocs I've added in @AutoConfigureWireMock in order to stub dependent services. I don't want Wiremock stubs generated. I can't see an obvious way to circumvent org.springframework.cloud.contract.wiremock.restdocs.WireMockRestDocsConfiguration from being loaded. Is my only option to stop using @AutoConfigureWiremock and manually set up the stub server as a Junit rule?
pablo-u
@pablo-u
Jun 07 2018 11:46
Hi @ryanjbaxter I tried with spring-cloud-netflix 1.2.2, and also tried importing ribbon 2.2.2
Ryan Baxter
@ryanjbaxter
Jun 07 2018 11:47
I mean spring cloud version, Camden, Dalston, Edgware, Finchley?
pablo-u
@pablo-u
Jun 07 2018 11:47
Camden
    <spring-cloud.version>Camden.SR2</spring-cloud.version>
Ryan Baxter
@ryanjbaxter
Jun 07 2018 11:49
Thats pretty old, can you try Edgware.SR3? At the very least Dalston.SR5
pablo-u
@pablo-u
Jun 07 2018 11:50
will try and keep you posted
thanks
does any one know what could be this error in zuul?
salaboy
@salaboy
Jun 07 2018 12:48
@ofabricio is there something after: Caused by: java.lang.NullPointerException: null
?
Fabricio
@ofabricio
Jun 07 2018 12:48
nothing.. that's the problem
Marcos Barbero
@marcosbarbero
Jun 07 2018 12:50
do you have any custom ZuulFilter?
Fabricio
@ofabricio
Jun 07 2018 12:51
yes many
Marcos Barbero
@marcosbarbero
Jun 07 2018 12:51
seems like the problem is here in this one at com.myproj.filter.RequestTimeLoggingFilter.doFilterInternal(RequestTimeLoggingFilter.java:25)
Fabricio
@ofabricio
Jun 07 2018 12:51
yes, it points to this line though: filterChain.doFilter(request, response);

@Component
@Slf4j
public class RequestTimeLoggingFilter extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        String requestStr = String.format("%s %s", request.getMethod(), request.getRequestURI());
        MDC.put("http_request", requestStr);

        long start = System.currentTimeMillis();

        filterChain.doFilter(request, response);

        long time = System.currentTimeMillis() - start;
        MDC.put("elapsed_time", String.valueOf(time));

        log.info("{} took {}ms", requestStr, time);
    }
}
this is the filter
actually just realized it is a OncePerRequestFilter...
any idea?
Marcos Barbero
@marcosbarbero
Jun 07 2018 12:53
add a breakpoint to this line and see what's the next filter in the chain? I dunno :smile:
Fabricio
@ofabricio
Jun 07 2018 12:55
the problem is it only happens in production :(
all other environments doesn't throw any error
Marcos Barbero
@marcosbarbero
Jun 07 2018 12:56
maybe you should do a remote debug to the production env
Fabricio
@ofabricio
Jun 07 2018 12:57
any link on how to do that?
Marcos Barbero
@marcosbarbero
Jun 07 2018 12:57
or trace the requests and see what's the difference between the environments
are you using embedded undertow?
Fabricio
@ofabricio
Jun 07 2018 12:57
yes
        <artifactId>spring-boot-starter-undertow</artifactId>
Fabricio
@ofabricio
Jun 07 2018 13:06
but after enabling remote debugging, not sure excatly how to do it
ill search ty
Marcos Barbero
@marcosbarbero
Jun 07 2018 13:08
you're welcome
Sushant
@bsushant-athena
Jun 07 2018 13:21
hi, I'm getting below error while trying to specify EIP for eureka
com.netflix.eureka.aws.EIPManager  - Could not bind to EIP
java.lang.StringIndexOutOfBoundsException: String index out of range: -4
This is my config file
eureka:
  datacenter: cloud
  name: eureka
  region: us-east-1
  us-east-1:
    availabilityZones: us-east-1a
  awsBindingStrategy: EIP
  shouldUseDns: false
  server:
    port: 8093
    preferSameZone: false
    enable-self-preservation: false
    binding-strategy: EIP
    eurekaServerURLContext: eureka
  instance:
    hostname: localhost
    ipAddress: 127.0.0.1
    preferIpAddress: true
    instanceId: ${spring.application.name}-${HOST}-${PORT0}
    metadataMap:
      instanceId: ${spring.application.name}-${HOST}-${PORT0}
      dockerImage: "gateway"
      enableRegisterFilter: "false"
  client:
    serviceUrl:
      defaultZone: http://18.206.144.70:${server.port}/eureka/
      us-east-1a: http://18.206.144.70:${server.port}/eureka/
KaijuDeluxe
@KaijuDeluxe
Jun 07 2018 13:29
i am getting nullpointer while using @Autowired
image.png
image.png
any idea? may it is because i run it on payara micro with jsg?
jsf
Andrew Fitzgerald
@fitzoh
Jun 07 2018 13:32
did you mean to post the same screenshot twice @KaijuDeluxe ?
KaijuDeluxe
@KaijuDeluxe
Jun 07 2018 13:34
oh shit :D
image.png
thats where i want to use the method checkPasswordValid from the Accesscontrol class
KaijuDeluxe
@KaijuDeluxe
Jun 07 2018 13:59
no one an idea?*
Marcos Barbero
@marcosbarbero
Jun 07 2018 15:08
is this being scanned?
Sushant
@bsushant-athena
Jun 07 2018 17:10
@marcosbarbero any idea?
Marcos Barbero
@marcosbarbero
Jun 07 2018 17:11
I didn’t have time to check your issue, make later today
Spencer Gibb
@spencergibb
Jun 07 2018 17:27
@/all if any are interested in an api change in gateway request predicates to allow non-blocking predicates spring-cloud/spring-cloud-gateway#350
Marcos Barbero
@marcosbarbero
Jun 07 2018 17:37
Thanks for sharing @spencergibb
Fabricio
@ofabricio
Jun 07 2018 18:44
Caused by: java.lang.IllegalStateException: Cannot parse the request!
    at com.netflix.zuul.http.HttpServletRequestWrapper.getParameter(HttpServletRequestWrapper.java:300)
    at org.springframework.cloud.netflix.zuul.filters.pre.DebugFilter.shouldFilter(DebugFilter.java:58)
    at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:109)
    at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:193)
    ... 77 common frames omitted
Caused by: java.io.IOException: UT000128: Remote peer closed connection before all data could be read
    at io.undertow.conduits.FixedLengthStreamSourceConduit.exitRead(FixedLengthStreamSourceConduit.java:338)
    at io.undertow.conduits.FixedLengthStreamSourceConduit.read(FixedLengthStreamSourceConduit.java:255)
    at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
    at io.undertow.channels.DetachableStreamSourceChannel.read(DetachableStreamSourceChannel.java:209)
    at io.undertow.server.HttpServerExchange$ReadDispatchChannel.read(HttpServerExchange.java:2332)
    at org.xnio.channels.Channels.readBlocking(Channels.java:294)
    at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:192)
    at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:168)
    at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:154)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1792)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744)
    at com.netflix.zuul.http.HttpServletRequestWrapper.parseRequest(HttpServletRequestWrapper.java:152)
    at com.netflix.zuul.http.HttpServletRequestWrapper.getParameter(HttpServletRequestWrapper.java:298)
    ... 80 common frames omitted
we have another exception in zuul... any idea what could fire that?
@spencergibb I'm interested in an easier way to change request/response body
last time I saw (months ago) wasn't easy.. dunno if something was done regarding that meanwhile
Marcos Barbero
@marcosbarbero
Jun 07 2018 18:50
If you are talking about zuul responde body transformation, it’s still the same
Fabricio
@ofabricio
Jun 07 2018 18:51
no.. i'm talking about spring-gateway way
Marcos Barbero
@marcosbarbero
Jun 07 2018 18:53
Then it’s a different story
If I’m not mistaken you can do some headers transformation, not sure about the body
Fabricio
@ofabricio
Jun 07 2018 18:55
you can but it's not that easy...
Marcos Barbero
@marcosbarbero
Jun 07 2018 18:55
I know it’s possible
Marcos Barbero
@marcosbarbero
Jun 07 2018 18:55
The subject was “is it easier now?”
And here we have Spencer for the rescue
Fabricio
@ofabricio
Jun 07 2018 18:56
ohh that looks cool
Spencer Gibb
@spencergibb
Jun 07 2018 18:56
there are still some issues and may be labeled beta at RELEASE time
Marcos Barbero
@marcosbarbero
Jun 07 2018 18:57
Once people starts to use it, i would say it’s going to evolve faster
Fabricio
@ofabricio
Jun 07 2018 18:58
we didn't use spring-gateway before bc of the body stuff, now we will consider it
Marcos Barbero
@marcosbarbero
Jun 07 2018 18:58
Like every other thing you guys provided
Just go for it @ofabricio its GA is already set and it’s mature enough
Fabricio
@ofabricio
Jun 07 2018 19:03
something that would be cool is to define a class in the yml for handling the body for each route
is that possible yet?
Spencer Gibb
@spencergibb
Jun 07 2018 19:04
No