Question #1: Is there a limit missing from the documentation?

It appears as though this is a possibility. As you point out the only limit 
> mentioned in the docs is 2 minutes, and you're below that amount of time 
> when you get the exception. It's possible the limit you're reaching is 
> unrelated to setSoTimeout() 
> <http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setSoTimeout(int)>,
>  
> or that setSoTimeout() is ineffective.

 

> Overall, I think this issue should be forwarded to the public issue 
> tracker <http://code.google.com/p/google-appengine/issues/list> with a 
> reproducing example snippet or entire app archive. This way, if the 
> behaviour is not correct, it can be quickly corrected. 


Question #2: Will I have any success with the NIO version of httpclient? 
I'm guessing not.

The docs <https://cloud.google.com/appengine/docs/java/sockets/> state that 
> "There is currently no support for sockets via java.nio.SocketChannel 
> <http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SocketChannel.html>
>  
> or otherjava.nio classes."


Question #3: Any suggestions for ways to work around this? It's part of an 
already-too-complicated multistep cascade of transactional task operations. 
This will be very hard to split up in any reasonable way.

>From my view, your options are to either A) figure out a fix (or wait for a 
> fix) for this socket issue, B) make a feature request for longer deadlines 
> on UrlFetch, or C) use a Managed VM 
> <https://cloud.google.com/appengine/docs/managed-vms/> instance which 
> will allow network connections not mediated through the UrlFetch service, 
> allowing longer timeouts. This assumes that "fix the HTTP endpoint which is 
> taking more than 60 seconds to respond" is off the table.


On Saturday, October 24, 2015 at 7:52:45 AM UTC-4, Jeff Schnitzer wrote:
>
> I'm calling a third-party HTTP service from a task that sometimes takes 
> more than 60s to respond. Since the URLFetchService has a hard limit of 
> 60s, I thought I might be able to work around this with the Socket API - 
> there do not appear to be any documented time limits other than the 2m idle.
>
> I wired in the Apache HttpClient... and I'm still getting an exception at 
> 60s, even though I explicitly set the timeout to 118s:
>
> Caused by: java.net.SocketException: Socket operation timed out: The API 
> call remote_socket.Receive() took too long to respond and was cancelled. at 
> com.google.appengine.api.socket.SocketApiHelper.makeSyncCall(
> SocketApiHelper.java:87 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=com%2Fgoogle%2Fappengine%2Fapi%2Fsocket%2FSocketApiHelper.java&line=87>)
>  
> at com.google.appengine.api.socket.AppEngineSocketImpl.receive(
> AppEngineSocketImpl.java:750 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=com%2Fgoogle%2Fappengine%2Fapi%2Fsocket%2FAppEngineSocketImpl.java&line=750>)
>  
> at com.google.appengine.api.socket.AppEngineSocketInputStream.read(
> AppEngineSocketInputStream.java:36 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=com%2Fgoogle%2Fappengine%2Fapi%2Fsocket%2FAppEngineSocketInputStream.java&line=36>)
>  
> at sun.security.ssl.InputRecord.readFully(InputRecord.java:442 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=sun%2Fsecurity%2Fssl%2FInputRecord.java&line=442>)
>  
> at sun.security.ssl.InputRecord.read(InputRecord.java:480 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=sun%2Fsecurity%2Fssl%2FInputRecord.java&line=480>)
>  
> at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:944 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=sun%2Fsecurity%2Fssl%2FSSLSocketImpl.java&line=944>)
>  
> at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:901 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=sun%2Fsecurity%2Fssl%2FSSLSocketImpl.java&line=901>)
>  
> at sun.security.ssl.AppInputStream.read(AppInputStream.java:102 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=sun%2Fsecurity%2Fssl%2FAppInputStream.java&line=102>)
>  
> at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(
> SessionInputBufferImpl.java:139 
> <https://console.developers.google.com/project/gearlaunch-hub/clouddev/debug/resolve_location?appModule=default&appVersion=2015-10-24-1046-build-2799&timestampNanos=1445685178512000000&file=org%2Fapache%2Fhttp%2Fimpl%2Fio%2FSessionInputBufferImpl.java&line=139>
> )
>
> Question #1: Is there a limit missing from the documentation?
>
> Question #2: Will I have any success with the NIO version of httpclient? 
> I'm guessing not.
>
> Question #3: Any suggestions for ways to work around this? It's part of an 
> already-too-complicated multistep cascade of transactional task operations. 
> This will be very hard to split up in any reasonable way.
>
> Thanks,
> Jeff
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/c81b8a0d-690d-48fd-ac86-1647b7b5261b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to