0

I have 2 springboot services a-service and b-service. They are communicating with eachother. And theese services working on docker different containers. When i send request from a-service to b-service if request time more than 15 minutes a-service cannot get response from b-service. Its not throwing error or timeout exception but process stucks in the row which i send request and does not going. a-service request code is below.

logger.info("Test 18 started...");
    try {
        //b-service url
        String url = ServiceModuleConstant.Menu.SYNCPOSMENU_URL + "/test18";
        logger.info("Scheduled system test URL : " + url);
        ResultModel control = RestClientUtils.postForObject(url,ResultModel.class,null);
        //does not come here anytime
        logger.info("Test 18 result : " + control.isSuccess());
    } catch (Exception e) {
        logger.error("Test 18 error : " + e.toString());
    }
    logger.info("Test 18 finished...");

by the way b-service complete request succesfully.

Is there any configuration setting for docker container about request timeouts.

  • What does your `RestClientUtils` do? Looks like a static call that creates things that should be singletons. You should also set some connection- and read timeouts on the http connections to prevent this hanging. – M. Deinum Aug 16 '22 at 07:49
  • RestClientUtils just using org.springframework.web.client.RestTemplate.execute() function. I was running this services without docker and there was no problem. When i published to docker container i faced this problem. – Atalay AKILLI Aug 16 '22 at 07:56
  • Regardless you shouldn't construct a `RestTemplate` each time you need it and you really need to set a connection- and readtime to prevent hangs. – M. Deinum Aug 16 '22 at 08:03

0 Answers0