[google-appengine] Re: SocketTimeoutException outbound request - spring boot resttemplate

2020-04-02 Thread 'goya' via Google App Engine


Hi, 

I have created a private issue on Issue Tracker to better investigate this 
issue as we will need access to your project to check the logs and use 
other internal tools to understand which might be the cause for these 
timeouts. 

You should be able to access the private issue by using the same email 
address you used to create this discussion. 

Further interactions will be done on: 
https://issuetracker.google.com/153078097 


On Monday, March 23, 2020 at 11:41:21 PM UTC+1, Ronald Bergmann wrote:
>
> We use the java11 runtime and F1 instances, spring boot 2.2.5 and didn't 
> experience the following issues with other apps deployed on GAE.
>
> When trying to perform an outbound (POST) request we end up with an 
> SocketTimeoutException:
>
> java.util.concurrent.ExecutionException: 
> org.springframework.web.client.ResourceAccessException: I/O error on POST 
> request for "https://xyz.tld/": connect timed out; nested exception is 
> java.net.SocketTimeoutException: connect timed out
> at 
> java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) 
> ~[na:na]
> at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205) 
> ~[na:na]
> at a.b.c.service.AddressService.get(AddressService.java:63) 
> ~[classes!/:0-0-4]
> at 
> a.b.c.rest.AddressRequestsController.d(AddressRequestsController.java:73) 
> ~[classes!/:0-0-4]
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method) ~[na:na]
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  
> ~[na:na]
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  
> ~[na:na]
> at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
> at 
> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
>  
> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
> at 
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
>  
> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
>...
>
> There's nothing fancy about resttemplate:
>
> restTemplate = new RestTemplateBuilder()
> .setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT))
> .setReadTimeout(Duration.ofMillis(READ_TIMEOUT))
> .build();
>
> ...
>
> restTemplate.postForEntity(searchUrl, request, String.class);
>
>
> With timeouts of 5 and 8 seconds.
> Runs fine locally and the other end is alive and responsive.
>
> Any ideas what's going wrong?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/3ace746a-5f9a-41d6-a145-753f2b2d472b%40googlegroups.com.


[google-appengine] Re: SocketTimeoutException outbound request - spring boot resttemplate

2020-03-27 Thread Ronald Bergmann
Hey nibrass,

there's no issue with Elastic. That was just an example of another app 
using resttemplate. But glancing at the code it actually does not seem to 
be based on spring's resttemplate.
Spring utilizes HttpURLConnection.


When leaving out the entry point mvn 
com.google.cloud.tools:appengine-maven-plugin:2.2.0:deploy fails with:

[INFO] GCLOUD: Error ID: 80D70A67.
[INFO] GCLOUD: Error type: InternalError.
[INFO] GCLOUD: Error message: Failed to generate app command: failure to 
generate application start command: missing entrypoint entry in app.yaml.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/e296ad4a-d6d1-4531-883a-bf85d88948f1%40googlegroups.com.


[google-appengine] Re: SocketTimeoutException outbound request - spring boot resttemplate

2020-03-27 Thread 'nibrass' via Google App Engine

Hi Ronald,

The entrypoint is optional, if you are not using a custom jar, you don't 
need an entrypoint [1]

The SocketTimeOutException could be caused when you are trying to connect 
to Elastic. Are you using sockets in your request?

Where do you have Elastic?

Looking forward to your reply.

Sincerely,

Nibrass Haider

=

[1] 
https://cloud.google.com/appengine/docs/standard/java11/config/appref#entrypoint



On Thursday, March 26, 2020 at 1:12:52 PM UTC+1, Ronald Bergmann wrote:
>
> Hi Nibrass,
>
>
> 1) Standard java11
>
>
> app.yaml:
>
> # [START runtime]runtime: java11instance_class: F1automatic_scaling:
>   min_instances: 0
>   min_idle_instances: 0
>   max_instances: 2
> entrypoint: java -noverify -jar app.jar
> inbound_services:
>   - warmup
> env_variables:
>   JAVA_TOOL_OPTIONS: "-XX:MaxRAM=256 -Xmx32m"# [END runtime]
>
>
> I also wonder why I suddenly need the entrypoint. I didn't have to specify 
> one with the other app(s), I think.
>
>
> 2) Pretty much what's above:
>
>
> // request headersfinal HttpHeaders headers = new 
> HttpHeaders();headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);headers.set("Referer",
>  REFERER);headers.set("User-Agent", 
> uaString);headers.setAccept(Collections.singletonList(MediaType.ALL));// 
> valuesfinal MultiValueMap values = new 
> LinkedMultiValueMap<>();values.add("suchart", "detail");
> // ... and some othersfinal HttpEntity> request 
> = new HttpEntity<>(values, headers);if (restTemplate == null)
> restTemplate = new RestTemplateBuilder()
> .setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT))
> .setReadTimeout(Duration.ofMillis(READ_TIMEOUT))
> .build();return restTemplate.postForEntity(searchUrl, request, 
> String.class);
>
>
> 3) Yupp. Here's the app.yaml of another app:
>
>
> # [START runtime]runtime: java11instance_class: F2automatic_scaling:
>   min_instances: 1
>   min_idle_instances: 1
>   max_instances: 8
> #entrypoint: java -noverify -jar -0.0.1-SNAPSHOT.jarinbound_services:
>   - warmup
> env_variables:
>   JAVA_TOOL_OPTIONS: "-XX:MaxRAM=512m -Xmx64m"# [END runtime]
>
>
> No entrypoint specified here. This app does not use the same resttemplate 
> but at least 
> org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate 
> without issues.
>
> Hope this helps. If you need the project ID or anything else just let me 
> know.
>
>
>
>
> Am Mittwoch, 25. März 2020 15:31:34 UTC+1 schrieb nibrass:
>>
>> Hello Ronald,
>>
>> In order to investigate further and determine your issue, could you 
>> please answer the following:
>>
>> 1) Are you using Google App Engine Standard or Flexible?
>> 2) What are you doing in your code ( calls to other Google Cloud Platform 
>> products , etc ) ?
>> 3) Other apps deployed in Google Cloud Platform is also using java11 
>> runtime? 
>>
>> Could you please share your app.yaml file?
>>
>> Thank you.
>>
>> Nibrass Haider
>>
>>
>> On Monday, March 23, 2020 at 11:41:21 PM UTC+1, Ronald Bergmann wrote:
>>>
>>> We use the java11 runtime and F1 instances, spring boot 2.2.5 and didn't 
>>> experience the following issues with other apps deployed on GAE.
>>>
>>> When trying to perform an outbound (POST) request we end up with an 
>>> SocketTimeoutException:
>>>
>>> java.util.concurrent.ExecutionException: 
>>> org.springframework.web.client.ResourceAccessException: I/O error on POST 
>>> request for "https://xyz.tld/": connect timed out; nested exception is 
>>> java.net.SocketTimeoutException: connect timed out
>>> at 
>>> java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) 
>>> ~[na:na]
>>> at 
>>> java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205) ~[na:na]
>>> at a.b.c.service.AddressService.get(AddressService.java:63) 
>>> ~[classes!/:0-0-4]
>>> at 
>>> a.b.c.rest.AddressRequestsController.d(AddressRequestsController.java:73) 
>>> ~[classes!/:0-0-4]
>>> at 
>>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>>> Method) ~[na:na]
>>> at 
>>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>  
>>> ~[na:na]
>>> at 
>>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>  
>>> ~[na:na]
>>> at java.base/java.lang.reflect.Method.invoke(Method.java:566) 
>>> ~[na:na]
>>> at 
>>> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
>>>  
>>> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
>>> at 
>>> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
>>>  
>>> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
>>>...
>>>
>>> There's nothing fancy about resttemplate:
>>>
>>> restTemplate = new RestTemplateBuilder()
>>> .setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT))
>>> .setReadTimeout(Duration.ofMillis(READ_TIMEOUT))
>>>

[google-appengine] Re: SocketTimeoutException outbound request - spring boot resttemplate

2020-03-26 Thread Ronald Bergmann


Hi Nibrass,


1) Standard java11


app.yaml:

# [START runtime]runtime: java11instance_class: F1automatic_scaling:
  min_instances: 0
  min_idle_instances: 0
  max_instances: 2
entrypoint: java -noverify -jar app.jar
inbound_services:
  - warmup
env_variables:
  JAVA_TOOL_OPTIONS: "-XX:MaxRAM=256 -Xmx32m"# [END runtime]


I also wonder why I suddenly need the entrypoint. I didn't have to specify 
one with the other app(s), I think.


2) Pretty much what's above:


// request headersfinal HttpHeaders headers = new 
HttpHeaders();headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);headers.set("Referer",
 REFERER);headers.set("User-Agent", 
uaString);headers.setAccept(Collections.singletonList(MediaType.ALL));// 
valuesfinal MultiValueMap values = new 
LinkedMultiValueMap<>();values.add("suchart", "detail");
// ... and some othersfinal HttpEntity> request = 
new HttpEntity<>(values, headers);if (restTemplate == null)
restTemplate = new RestTemplateBuilder()
.setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT))
.setReadTimeout(Duration.ofMillis(READ_TIMEOUT))
.build();return restTemplate.postForEntity(searchUrl, request, 
String.class);


3) Yupp. Here's the app.yaml of another app:


# [START runtime]runtime: java11instance_class: F2automatic_scaling:
  min_instances: 1
  min_idle_instances: 1
  max_instances: 8
#entrypoint: java -noverify -jar -0.0.1-SNAPSHOT.jarinbound_services:
  - warmup
env_variables:
  JAVA_TOOL_OPTIONS: "-XX:MaxRAM=512m -Xmx64m"# [END runtime]


No entrypoint specified here. This app does not use the same resttemplate 
but at least 
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate 
without issues.

Hope this helps. If you need the project ID or anything else just let me 
know.




Am Mittwoch, 25. März 2020 15:31:34 UTC+1 schrieb nibrass:
>
> Hello Ronald,
>
> In order to investigate further and determine your issue, could you please 
> answer the following:
>
> 1) Are you using Google App Engine Standard or Flexible?
> 2) What are you doing in your code ( calls to other Google Cloud Platform 
> products , etc ) ?
> 3) Other apps deployed in Google Cloud Platform is also using java11 
> runtime? 
>
> Could you please share your app.yaml file?
>
> Thank you.
>
> Nibrass Haider
>
>
> On Monday, March 23, 2020 at 11:41:21 PM UTC+1, Ronald Bergmann wrote:
>>
>> We use the java11 runtime and F1 instances, spring boot 2.2.5 and didn't 
>> experience the following issues with other apps deployed on GAE.
>>
>> When trying to perform an outbound (POST) request we end up with an 
>> SocketTimeoutException:
>>
>> java.util.concurrent.ExecutionException: 
>> org.springframework.web.client.ResourceAccessException: I/O error on POST 
>> request for "https://xyz.tld/": connect timed out; nested exception is 
>> java.net.SocketTimeoutException: connect timed out
>> at 
>> java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) 
>> ~[na:na]
>> at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205) 
>> ~[na:na]
>> at a.b.c.service.AddressService.get(AddressService.java:63) 
>> ~[classes!/:0-0-4]
>> at 
>> a.b.c.rest.AddressRequestsController.d(AddressRequestsController.java:73) 
>> ~[classes!/:0-0-4]
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method) ~[na:na]
>> at 
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>  
>> ~[na:na]
>> at 
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>  
>> ~[na:na]
>> at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
>> at 
>> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
>>  
>> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
>> at 
>> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
>>  
>> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
>>...
>>
>> There's nothing fancy about resttemplate:
>>
>> restTemplate = new RestTemplateBuilder()
>> .setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT))
>> .setReadTimeout(Duration.ofMillis(READ_TIMEOUT))
>> .build();
>>
>> ...
>>
>> restTemplate.postForEntity(searchUrl, request, String.class);
>>
>>
>> With timeouts of 5 and 8 seconds.
>> Runs fine locally and the other end is alive and responsive.
>>
>> Any ideas what's going wrong?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/5b9cd83e-fd75-4f6f-b3c0-4d2d594f465a%40googlegroups.com.


[google-appengine] Re: SocketTimeoutException outbound request - spring boot resttemplate

2020-03-25 Thread 'nibrass' via Google App Engine
Hello Ronald,

In order to investigate further and determine your issue, could you please 
answer the following:

1) Are you using Google App Engine Standard or Flexible?
2) What are you doing in your code ( calls to other Google Cloud Platform 
products , etc ) ?
3) Other apps deployed in Google Cloud Platform is also using java11 
runtime? 

Could you please share your app.yaml file?

Thank you.

Nibrass Haider


On Monday, March 23, 2020 at 11:41:21 PM UTC+1, Ronald Bergmann wrote:
>
> We use the java11 runtime and F1 instances, spring boot 2.2.5 and didn't 
> experience the following issues with other apps deployed on GAE.
>
> When trying to perform an outbound (POST) request we end up with an 
> SocketTimeoutException:
>
> java.util.concurrent.ExecutionException: 
> org.springframework.web.client.ResourceAccessException: I/O error on POST 
> request for "https://xyz.tld/": connect timed out; nested exception is 
> java.net.SocketTimeoutException: connect timed out
> at 
> java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) 
> ~[na:na]
> at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205) 
> ~[na:na]
> at a.b.c.service.AddressService.get(AddressService.java:63) 
> ~[classes!/:0-0-4]
> at 
> a.b.c.rest.AddressRequestsController.d(AddressRequestsController.java:73) 
> ~[classes!/:0-0-4]
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method) ~[na:na]
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  
> ~[na:na]
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  
> ~[na:na]
> at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
> at 
> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
>  
> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
> at 
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
>  
> ~[spring-web-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
>...
>
> There's nothing fancy about resttemplate:
>
> restTemplate = new RestTemplateBuilder()
> .setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT))
> .setReadTimeout(Duration.ofMillis(READ_TIMEOUT))
> .build();
>
> ...
>
> restTemplate.postForEntity(searchUrl, request, String.class);
>
>
> With timeouts of 5 and 8 seconds.
> Runs fine locally and the other end is alive and responsive.
>
> Any ideas what's going wrong?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/e058d85b-c580-4578-9068-011257a93e8a%40googlegroups.com.