<p>I have a cluster on GKE and one of my deployments run tornado web app to receive http requests.
This deployment is exposed by a LoadBalancer.
I send a simple http request to the LoadBalancer ip, which must run on server side for ~10 minutes.
After exactly 5 minutes, I get:</p>
<pre><code>requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
</code></pre>
<p>I tried:</p>
<ul>
<li>Using the communication locally on my computer (both client and server) and haven't got the reset.</li>
<li>I made kubectl port-forward directly to the deployment (local client -&gt; kubectl port-forward -&gt; deployment -&gt; server) and haven't got the connection reset.
So basically I'm pretty sure it's on the loadbalnacer side.</li>
<li>I made a backend config with this configuration:</li>
</ul>
<pre><code>apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
  name: my-bsc-backendconfig
spec:
  timeoutSec: 3600
</code></pre>
<p>and my loadbalancer is configured like this:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    cloud.google.com/backend-config: '{&quot;ports&quot;: {&quot;5000&quot;:&quot;my-bsc-backendconfig&quot;}'
  creationTimestamp: &quot;2020-12-24T10:08:54Z&quot;
  finalizers:
  - service.kubernetes.io/load-balancer-cleanup
  labels:
    name: wesnapp-flask
  name: wesnapp-flask-service
  namespace: default
  resourceVersion: &quot;14652233&quot;
  selfLink: /api/v1/namespaces/default/services/wesnapp-flask-service
  uid: a922e9cb-4702-481f-b1a9-e09df1653ff7
spec:
  clusterIP: 10.64.9.113
  externalTrafficPolicy: Cluster
  ports:
  - nodePort: 31429
    port: 5000
    protocol: TCP
    targetPort: 5000
  selector:
    name: wesnapp-flask
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - ip: x.x.x.x

</code></pre>
<p>Any ideas how to solve this problem?
Thanks</p>

<p>Your assumption is right. GCE LoadBalancer kills the connection.<br />
As mentioned in <a href="https://cloud.google.com/load-balancing/docs/l7-internal" rel="nofollow noreferrer">this Google document</a>, there is a <code>Stream idle timeout</code> configured to 300 seconds (5 minutes) and can't be changed. HTTP streams become idle after 5 minutes without activity.</p>
