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

16th
Jan 2018
Haruhiko Nishi
@hanishi
Jan 16 2018 09:34

Hi, I would like to know if the following behavior is expected and whether it's possible to prevent the Exeption from occurring.

  1. @EnableDiscoveryClient annotated applications areloaded with a @ConfigurationProperties that is @RefreshScopeed and they register themselves as httpclient-processor-kafka with Eureka service registry.

  2. Another application with @EnableDiscoveryClient and @EnableFeignClients whose interface is defined as below:

@FeignClient(serviceId = "httpclient-processor-kafka")
interface HttpClientProcessorRefresh {

    @RequestMapping(method = RequestMethod.POST, value = "/management/refresh")
    void propagateRefresh();
}

which is used in the following class

@RestController
@RequestMapping("/httpclient-processor")
class HttpclientProcessorApiGateway {

    private final HttpClientProcessorRefresh refresh;

    @Autowired
    HttpclientProcessorApiGateway(HttpClientProcessorRefresh refresh) {
        this.refresh = refresh;
    }

    @PostMapping("reload")
    public ResponseEntity<?> reload() {
        refresh.propagateRefresh();
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
  1. when the api endpoint above is executed
 curl -X POST http://localhost:8082/httpclient-processor/reload

I get the response

{"timestamp":1516080330451,"status":500,"error":"Internal Server Error","exception":"feign.RetryableException","message":"Read timed out executing POST http://httpclient-processor-kafka/management/refresh","path":"/euler-httpclient-processor/reload"}
  1. The httpclient-processor-kafka is refreshed but the following error occurs in the caller's log.
    There is also "disconnection" of DiscoveryClient at the httpclient-processor-kafka when refresh is propagated.
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_152]
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_152]
    at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[na:1.8.0_152]
    at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_152]
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_152]
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[na:1.8.0_152]
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[na:1.8.0_152]
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735) ~[na:1.8.0_152]
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678) ~[na:1.8.0_152]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587) ~[na:1.8.0_152]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[na:1.8.0_152]
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[na:1.8.0_152]
    at feign.Client$Default.convertResponse(Client.java:152) ~[feign-core-9.5.0.jar:na]
    at feign.Client$Default.execute(Client.java:74) ~[feign-core-9.5.0.jar:na]
    at org.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:80) ~[spring-cloud-netflix-core-1.4.0.RELEASE.jar:1.4.0.RELEASE]
and the this is what happens when refresh is propagated.
2018-01-16 17:02:15.415  INFO 4888 --- [io-63955-exec-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@33e636f0: startup date [Tue Jan 16 17:02:15 JST 2018]; root of context hierarchy
2018-01-16 17:02:15.449  INFO 4888 --- [io-63955-exec-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-01-16 17:02:15.481  INFO 4888 --- [io-63955-exec-1] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$bd685fec] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-16 17:02:15.860  INFO 4888 --- [io-63955-exec-1] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2018-01-16 17:02:16.864  WARN 4888 --- [io-63955-exec-1] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/euler-httpclient-processor-kafka/transfer": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2018-01-16 17:02:16.865  INFO 4888 --- [io-63955-exec-1] o.s.boot.SpringApplication               : The following profiles are active: transfer
2018-01-16 17:02:16.872  INFO 4888 --- [io-63955-exec-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@22e6a957: startup date [Tue Jan 16 17:02:16 JST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@33e636f0
2018-01-16 17:02:16.877  INFO 4888 --- [io-63955-exec-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-01-16 17:02:16.911  INFO 4888 --- [io-63955-exec-1] o.s.boot.SpringApplication               : Started application in 1.912 seconds (JVM running for 90.062)
2018-01-16 17:02:16.912  INFO 4888 --- [io-63955-exec-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@22e6a957: startup date [Tue Jan 16 17:02:16 JST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@33e636f0
2018-01-16 17:02:17.449  INFO 4888 --- [io-63955-exec-1] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2018-01-16 17:02:17.451  INFO 4888 --- [io-63955-exec-1] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2018-01-16 17:02:17.452  INFO 4888 --- [io-63955-exec-1] com.netflix.discovery.DiscoveryClient    : Unregistering ...
2018-01-16 17:02:17.462  INFO 4888 --- [io-63955-exec-1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_HTTPCLIENT-PROCESSOR-KAFKA/XXXXXXXXXXX:euler-httpclient-processor-kafka:63955 - deregister  status: 200
Dave Syer
@dsyer
Jan 16 2018 09:38
Do you have a sample app in github?
All of the above looks kind of normal. But I don't understand the feign client timeout.
Haruhiko Nishi
@hanishi
Jan 16 2018 09:41

@dsyer
I have to rename packages but I can push to my public repo later.

Here is the curl I used to refresh

$ curl -v --noproxy localhost -X POST http://localhost:8082/httpclient-processor/reload
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8082 (#0)
> POST /euler-httpclient-processor/reload HTTP/1.1
> Host: localhost:8082
> User-Agent: curl/7.56.1
> Accept: */*
>
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0< HTTP/1.1 500
< X-Application-Context: service-edge:8082
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Tue, 16 Jan 2018 06:45:50 GMT
< Connection: close
<
{ [263 bytes data]
100   256    0   256    0     0    256      0 --:--:--  0:00:01 --:--:--   139{"timestamp":1516085150924,"status":500,"error":"Internal Server Error","exception":"feign.RetryableException","message":"Read timed out executing POST http://httpclient-processor-kafka/management/refresh","path":"/httpclient-processor/reload"}
Haruhiko Nishi
@hanishi
Jan 16 2018 13:03
@dsyer I really have to apologize for troubling you for my question above.
I don't know why but when I tested the code where no corporate proxy is involved I get no Exception as aforementioned at all when refresh is performed. So far, all of my problems have been caused by the corporate proxy.
Dave Syer
@dsyer
Jan 16 2018 13:04
I guess that's good (since we isolated the problem), and bad (don't really understand how it happened)
Haruhiko Nishi
@hanishi
Jan 16 2018 13:05
any request, even to localhost is forwarded to corporate proxy...
Jagmohan Sharma
@JagmohanSharma
Jan 16 2018 15:12
Hi @dsyer , I have updated issue spring-cloud/spring-cloud-commons#308 with more description. Please have a look. Thanks.
Dave Syer
@dsyer
Jan 16 2018 15:13
I still don't get it
It seems very complicated
Jagmohan Sharma
@JagmohanSharma
Jan 16 2018 15:29
ok :(
I will update the github code with running sample.
restwzeasy
@restwzeasy
Jan 16 2018 20:55
@spencergibb are there configurations to control/disable self-signed cert validation in Spring Cloud Vault?
Spencer Gibb
@spencergibb
Jan 16 2018 21:00
Not that I know of.